FieldsAsColumn / Struct Layer
Extract specific fields from a struct column into separate columns. Similar to Polars struct.field() or pandas json_normalize() with specific fields.
Example transformation:
Input struct column 'data':
data |
---|
{name: 'John', age: 30, city: 'NYC'} |
{name: 'Mary', age: 25, city: 'LA'} |
After extracting fields ['name', 'age']:
name | age |
---|---|
John | 30 |
Mary | 25 |
Common applications:
- Selective struct unpacking
- Extracting specific nested fields
- Converting struct fields to columns
- Flattening partial nested data
- Creating focused views of structured data
Note: New columns are named exactly as the struct fields. Existing columns with matching names will be replaced.
Table
0
0
Table
Select
columnThe struct column to extract fields from. Expected format:
- Contains named fields: {field1: value1, field2: value2}
- Consistent structure across rows
- Fields must exist in the struct
Fields
[, ...]List of fields to extract from the struct. Each field will become a new column. Example selections:
- ['name', 'age'] for basic info
- ['id', 'timestamp'] for metadata
- ['latitude', 'longitude'] for coordinates
Must specify at least one field.
Field
stringName of the field to extract from the struct. Must match exactly with field names in the struct. Examples:
- 'name' for name field
- 'user_id' for ID field
- 'timestamp' for time field