Skip to main content

rewrite_lateral_unnest

Function rewrite_lateral_unnest 

Source
pub fn rewrite_lateral_unnest(sql: &str) -> String
Expand description

Rewrite LATERAL UNNEST(...) idioms to a form DataFusion understands.

Normalises:

SELECT * FROM t, LATERAL UNNEST(t.tags) AS tag(value)

to:

SELECT * FROM t CROSS JOIN UNNEST(t.tags) AS tag(value)

Queries that do not contain LATERAL UNNEST are returned unchanged.

§Limitations

Only handles the common single-table LATERAL UNNEST idiom. Complex uses (multiple LATERAL joins, LATERAL subqueries) are passed through to DataFusion which will either handle them or return a clear error.