Last / List Layer
Extract the last element from each variable-length list. Similar to list[-1] indexing in Python or tail(1) in R. Returns null for empty lists.
Example transformation:
lists | last |
---|---|
[1, 2, 3, 4] | 4 |
[x, y] | y |
[true] | true |
[1, null, 3, null] | null |
[] | null |
Common applications:
- Getting most recent events in time-ordered lists
- Extracting final states from sequences
- Accessing latest measurements
- Finding last transactions in histories
- Processing most recent log entries
- Retrieving final status updates
Note: Lists can have any length, including empty. Returns null for empty lists or if last element is null. Preserves original element type. Particularly useful for accessing the most recent item in time-ordered sequences.
Table
0
0
Table
Select
columnThe variable-length list column to access. Supports various types:
- Time series: [val1, val2, val3, val4]
- Event logs: [event1, event2]
- Status updates: [status1, status2, status3]
- Measurements: [1.1, 1.2, 1.3] Lists can have different lengths, including empty lists
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.