Mihai Budiu created CALCITE-7719:
------------------------------------

             Summary: Field access on an element of a ROW array built by a 
sub-query raises IllegalArgumentException
                 Key: CALCITE-7719
                 URL: https://issues.apache.org/jira/browse/CALCITE-7719
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.42.0
            Reporter: Mihai Budiu
            Assignee: Mihai Budiu


The following query

{code}
select t.a[1]."EXPR$0"."EXPR$1" as v
from (select array(select ROW(ROW(1, 2), 3) from (values (0))) as a) as t;
{code}

crashes in SubQueryRemoveRule with

{code}
Caused by: java.lang.IllegalArgumentException: not found: ARRAY({
LogicalProject(EXPR$0=[ROW(ROW(1, 2), 3)])
  LogicalValues(tuples=[[{ 0 }]])
})
        at org.apache.calcite.rex.LogicVisitor.find(LogicVisitor.java:84)
        at 
org.apache.calcite.rel.rules.SubQueryRemoveRule.matchProject(SubQueryRemoveRule.java:973)
        at 
org.apache.calcite.rel.rules.SubQueryRemoveRule.access$500(SubQueryRemoveRule.java:85)
        at 
org.apache.calcite.rel.rules.SubQueryRemoveRule$Config.lambda$static$0(SubQueryRemoveRule.java:1426)
        at 
org.apache.calcite.rel.rules.SubQueryRemoveRule.onMatch(SubQueryRemoveRule.java:96)
        at 
org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:380)
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to