[ https://issues.apache.org/jira/browse/CALCITE-4063?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ruben Q L resolved CALCITE-4063. -------------------------------- Fix Version/s: 1.24.0 Resolution: Fixed Fixed by https://github.com/apache/calcite/commit/797b48754d074d53e853a67bf249c155f51b71dc Thanks [~mmior] for your help! > Unnest an array of single-item structs causes ClassCastException > ---------------------------------------------------------------- > > Key: CALCITE-4063 > URL: https://issues.apache.org/jira/browse/CALCITE-4063 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.23.0 > Reporter: Ruben Q L > Assignee: Ruben Q L > Priority: Major > Labels: pull-request-available > Fix For: 1.24.0 > > Attachments: DynamicCode.java > > Time Spent: 1h 50m > Remaining Estimate: 0h > > If we run the following queries with UNNEST operator, we get the expected > results: > {code:sql} > select * from UNNEST(array[3, 4]) as T2(y); > -- y=3 > -- y=4 > select * from UNNEST(array[array[3], array[4]]) as T2(y) > -- y=[3] > -- y=[4] > select * from UNNEST(array[ROW(3), ROW(4)]) as T2(y) > -- y=[3] > -- y=[4] > -- Is this result ok? (see first comment of the current ticket) > {code} > However, if we try to combine them with a correlation with some other values, > as we could do in more realistic examples: > {{select * from dept_nested as d, UNNEST(d.employees) e2}} > The first two return the expected results, but the last one throws an > exception: > {code:sql} > select * from (values (1), (2)) T1(x), UNNEST(array[3, 4]) as T2(y); > -- x=1; y=3 > -- x=1; y=4 > -- x=2; y=3 > -- x=2; y=4 > select * from (values (1), (2)) T1(x), UNNEST(array[array[3], array[4]]) as > T2(y); > -- x=1; y=[3] > -- x=1; y=[4] > -- x=2; y=[3] > -- x=2; y=[4] > select * from (values (1), (2)) T1(x), UNNEST(array[ROW(3), ROW(4)]) as T2(y); > -- ERROR!!! > -- java.lang.ClassCastException: > org.apache.calcite.runtime.FlatLists$Flat1List cannot be cast to > java.lang.Integer > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)