[ https://issues.apache.org/jira/browse/IMPALA-10838?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tamas Mate updated IMPALA-10838: -------------------------------- Target Version: Impala 4.2.0 (was: Impala 4.1.0) > Error when struct returned from WITH() and used in an ORDER BY > -------------------------------------------------------------- > > Key: IMPALA-10838 > URL: https://issues.apache.org/jira/browse/IMPALA-10838 > Project: IMPALA > Issue Type: Bug > Components: Frontend > Reporter: Gabor Kaszab > Assignee: Daniel Becker > Priority: Major > Labels: complextype, nested_types > > {code:java} > with sub as ( > select id, small_struct > from functional_orc_def.complextypes_structs > where length(small_struct.s) > 5) > select sub.id, sub.small_struct from sub order by sub.small_struct.i desc; > {code} > The above query results an error when trying to run SlotRef.toThrift() > {code:java} > ERROR: IllegalStateException: Illegal reference to non-materialized tuple: > debugname=InlineViewRef sub alias=sub tid=2 > {code} > If I rewrite the query a bit to return the member of the struct from the > inline view (WITH()) and use this in the ORDER by then the query succeeds as > expected: > {code:java} > with sub as ( > select id, small_struct, small_struct.i as si > from functional_orc_def.complextypes_structs where small_struct.i > 19200) > select sub.id, sub.small_struct from sub order by sub.si desc; > {code} > In SortNode.toThrift() I checked what the sort exprs and the resolved tuple > exprs are and I see a difference that could be the cause. > In the problematic case: > {code:java} > - sort exprs in SortNode: > SlotRef{label=small_struct.i, type=INT, id=15} > - resolved exprs in SortNode: > SlotRef{label=id, path=id, type=INT, id=0} > SlotRef{label=small_struct, path=small_struct, type=STRUCT<i:INT,s:STRING>, > id=1} > *SlotRef{label=sub.small_struct.i, path=sub.small_struct.i, type=INT, > id=10}* > {code} > In the successful case: > {code:java} > - sort exprs in SortNode: > SlotRef{label=si, type=INT, id=14} > - resolved exprs in SortNode: > SlotRef{label=id, path=id, type=INT, id=0} > SlotRef{label=small_struct, path=small_struct, type=STRUCT<i:INT,s:STRING>, > id=1} > *SlotRef{label=small_struct.i, path=small_struct.i, type=INT, id=4}* > {code} -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org For additional commands, e-mail: issues-all-h...@impala.apache.org