Slice / List Layer
Extract a contiguous subsequence from each variable-length list using fixed offset and length. Similar to Python's list slicing or R's slice(). Returns a new list containing the specified elements.
Example transformation:
With offset=1, length=2:
lists | slice |
---|---|
[1, 2, 3, 4] | [2, 3] |
[a, b, c] | [b, c] |
[x, y] | [y] |
[q] | [] |
With offset=-2, length=2:
lists | slice |
---|---|
[1, 2, 3, 4] | [3, 4] |
[a, b, c] | [b, c] |
[x, y] | [y] |
[] | [] |
Common applications:
- Extracting recent history windows
- Processing time series segments
- Creating sliding windows
- Analyzing sequence patterns
- Taking list subsets
- Implementing pagination
Note: Lists can have any length. Returns empty list if offset is out of bounds. Length is automatically adjusted if it extends beyond list bounds. Particularly useful for working with sequential data windows.
Select
columnThe variable-length list column to slice. Examples:
- Time series: [val1, val2, val3, val4]
- Event logs: [event1, event2, event3]
- Message history: [msg1, msg2]
- Measurements: [1.1, 1.2, 1.3] Lists can have different lengths. Supports any data type.
Offset
i64Starting position (Offset
) for the slice. Examples:
- 0: Start from beginning
- 2: Start from third element
- -1: Start from last element
- -2: Start from second-to-last element Supports negative indexing (counting from end)
Length
u64Number of elements (Length
) to include in slice. Examples:
- 0: Take all elements from offset to end
- 1: Take one element
- 2: Take two elements Automatically adjusted if extends beyond list bounds
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.