Len / List Layer
Calculate the number of elements in each variable-length list. Similar to Python's len() or R's length(). Returns an integer column containing the count of elements in each list.
Example transformation:
lists | length |
---|---|
[1, 2, 3, 4] | 4 |
[a, b] | 2 |
[true] | 1 |
[1, null, 3, null] | 4 |
[] | 0 |
Common applications:
- Analyzing sequence lengths
- Validating list sizes
- Counting event occurrences
- Measuring transaction volumes
- Monitoring data completeness
- Analyzing interaction frequencies
Note: Counts all elements including nulls. Empty lists return 0. Useful for analyzing the size distribution of variable-length data or identifying unusually long or short sequences.
Table
0
0
Table
Select
columnThe variable-length list column to measure. Examples:
- Transaction histories: [t1, t2, t3]
- User interactions: [click1, click2]
- Time series samples: [1.1, 1.2, 1.3, 1.4]
- Event sequences: [event1] 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.