Get / List Layer
Extract element at specified index from each variable-length list. Similar to list[i] indexing in Python or nth() in R. Returns a column containing elements at the specified position, supporting both positive and negative indexing.
Example transformation:
Positive indexing (index=1):
lists | element |
---|---|
[1, 2, 3, 4] | 2 |
[x, y] | y |
[a] | null |
[] | null |
[null, b, c] | b |
Negative indexing (index=-1):
lists | element |
---|---|
[1, 2, 3, 4] | 4 |
[x, y] | y |
[a] | a |
[] | null |
[a, b, null] | null |
Common applications:
- Accessing most recent entries in time-ordered lists
- Extracting specific elements from log sequences
- Getting last transaction from history
- Selecting specific measurements from samples
- Accessing elements by relative position
- Processing periodic data points
Note: Lists can have any length. Returns null for out-of-bounds indices. Positive indices start from 0, negative indices count from end (-1 for last element). Preserves null values at specified position. Particularly useful for accessing elements in variable-length sequences by relative position.
Select
columnThe variable-length list column to access. Supports various types:
- Numeric lists: [1, 2, 3, 4], [5, 6]
- String lists: [first, second, third], [a]
- Boolean lists: [true, false, true], [false]
- Date/time lists: [2024-01-01, 2024-01-02], [] Lists can have different lengths, including empty lists
Index
oneofFixed
i32Position to extract (Index
). Supports both directions:
Positive (from start, 0-based):
- 0: First element
- 1: Second element
- 2: Third element Negative (from end):
- -1: Last element
- -2: Second-to-last element
- -3: Third-to-last element
SelectIdx
columnColumn containing indices. Each row can specify a different position to extract. Supports both positive and negative indices. Must contain valid integer values.
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.