Skip to main content

propagate_struct_field_names

Function propagate_struct_field_names 

Source
pub fn propagate_struct_field_names(expr: Expression) -> Result<Expression>
Expand description

Convert BigQuery-style UNNEST aliases to column-alias format for DuckDB/Presto/Spark.

BigQuery uses: UNNEST(arr) AS x where x is a column alias. DuckDB/Presto/Spark need: UNNEST(arr) AS _t0(x) where _t0 is a table alias and x is the column alias.

Propagate struct field names from the first named struct in an array to subsequent unnamed structs.

In BigQuery, [STRUCT('Alice' AS name, 85 AS score), STRUCT('Bob', 92)] means the second struct should inherit field names from the first: [STRUCT('Alice' AS name, 85 AS score), STRUCT('Bob' AS name, 92 AS score)].