coral
coral copied to clipboard
Trino SQL with `UNNEST(arrayOfStruct) AS t(col0, col1...)` cannot be converter to CoralIR
Currently, Coral supports unnesting an operand into a single row type.
Ex:
For a table default.struct
defined as - default.struct(a int, b array<struct<b1:string, b2:int>>
input query: SELECT * from default.struct cross join unnest(struct.b) AS t(ccol)
has a CoralIR representation.
However, OSS trino supports expanding the unnest operand into multiple columns. But coral doesn't accept the following as a valid trino input SQL: SELECT * from default.struct cross join unnest(struct.b) AS t(ccol1, ccol2)
A potential solution can be to introduce 2 types of uncollect relNodes in CoralIR - (1) Uncollect1 and (2) UncollectN to determine the number of columns unnest()
should expand to (1 or more).