ToArray / List Layer
Convert lists to fixed-width arrays, requiring all input lists to have the same length. The width parameter must match the length of input lists. Similar to enforcing fixed-length array constraints in numpy or arrow.
Example transformation (width=3):
lists | arrays |
---|---|
[1, 2, 3] | [1, 2, 3] |
[a, b, c] | [a, b, c] |
[x, y, z] | [x, y, z] |
[1, null, 3] | [1, null, 3] |
Invalid inputs (will error):
- [1, 2] (too short)
- [1, 2, 3, 4] (too long)
- [] (empty list)
Common applications:
- Enforcing fixed-width constraints
- Validating data dimensionality
- Converting to strict array format
- Preparing data for fixed-width operations
- Ensuring uniform data structure
Note: All input lists must have exactly the same length as the specified width. Returns error if any list's length doesn't match the width parameter. Used for ensuring strict dimensional consistency in data.
Select
columnThe list column to convert. All lists must have same length. Examples:
- Three-element lists: [1, 2, 3], [4, 5, 6]
- Fixed-length sequences: [a, b, c], [x, y, z]
- Equal-sized measurements: [1.1, 1.2, 1.3] Lists must all have length equal to specified width.
Width
u32Required width (Width
) that all input lists must match. Examples:
- 3: All lists must have exactly 3 elements
- 5: All lists must have exactly 5 elements Operation fails if any list length doesn't match this width.
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.