Tail / List Layer
Create a new list containing the last N elements from each variable-length list. Similar to Python's list[-n:] or R's tail(). If the input list is shorter than N, returns all available elements.
Example transformation:
With N=2:
lists | tail |
---|---|
[1, 2, 3, 4] | [3, 4] |
[a, b, c] | [b, c] |
[x] | [x] |
[] | [] |
[1, null, 3, null] | [3, null] |
Common applications:
- Extracting recent transactions
- Getting latest log entries
- Analyzing recent events
- Viewing latest measurements
- Processing most recent updates
- Displaying recent activities
Note: Lists can have any length. Returns fewer elements if list length < N. Empty lists remain empty. Preserves null values within the taken range. Particularly useful for accessing recent items in time-ordered sequences.
Select
columnThe variable-length list column to extract from. Examples:
- Recent transactions: [tx1, tx2, tx3, tx4]
- System logs: [log1, log2, log3]
- User actions: [click1, click2]
- Sensor readings: [val1] Lists can have different lengths, including empty lists.
N
u32Number of elements (N
) to keep from end of each list. Examples:
- 1: Keep last element only
- 2: Keep last two elements
- 5: Keep last five elements Must be greater than 0
AsColumn
nameName for the new column. If not provided, the system generates a unique name. If AsColumn
matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.