FromColumns / Struct Layer

Combine multiple columns into a single struct column. Similar to pandas DataFrame.to_dict() or R's list construction.

Example transformation:

Input columns:

nameagecity
John30NYC
Mary25LA

After combining into struct:

user_info
{name: 'John', age: 30, city: 'NYC'}
{name: 'Mary', age: 25, city: 'LA'}

Common applications:

  • Creating nested data structures
  • Preparing data for JSON serialization
  • Grouping related columns
  • Building complex data types
  • Organizing hierarchical data

Note: Field names in the struct will match the original column names. The operation preserves the original data types within the struct.

Table
0
0
Table

Column

[, ...]

List of columns to combine into the struct. Order is preserved in the resulting struct. Example combinations:

  • ['name', 'age', 'city'] for user info
  • ['latitude', 'longitude'] for location
  • ['start_time', 'end_time'] for time range

Must specify at least one column.

Select

column

Column to include in the struct. The column name becomes the field name in the resulting struct. Examples:

  • 'name' becomes {name: value}
  • 'user_id' becomes {user_id: value}
  • 'timestamp' becomes {timestamp: value}

Name 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.