Head / List Layer
Create a new list containing the first N elements from each variable-length list. Similar to Python's list[:n] or R's head(). If the input list is shorter than N, returns all available elements.
Example transformation:
With N=2:
lists | head |
---|---|
[1, 2, 3, 4] | [1, 2] |
[a, b] | [a, b] |
[x] | [x] |
[] | [] |
Common applications:
- Creating preview snippets
- Limiting sequence lengths
- Sampling initial elements
- Extracting recent events
- Truncating long lists
- Creating fixed-length prefixes
Note: Returns fewer elements if input list length < N. Empty lists remain empty. Preserves null values within the taken range.
Table
0
0
Table
Select
columnThe variable-length list column to truncate. Examples:
- Time series: [v1, v2, v3, v4, v5]
- Log entries: [log1, log2, log3]
- Tag sequences: [tag1, tag2] Lists can have different lengths
N
u32Number of elements (N
) to keep from start of each list. Examples:
- 1: Keep first element only
- 2: Keep first two elements
- 5: Keep first 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.