Mihai Budiu created CALCITE-7961:
------------------------------------

             Summary: CorrelateProjectExtractor leaves out of requiredColumns a 
field that a table function call uses
                 Key: CALCITE-7961
                 URL: https://issues.apache.org/jira/browse/CALCITE-7961
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.42.0
            Reporter: Mihai Budiu
            Assignee: Mihai Budiu


In {{TableFunctionTest}} (schema {{s}} with the table function {{fibonacci2}}, 
conformance LENIENT), this query fails:
{code:sql}
select n
from (values 4) as t (c)
left join lateral table("s"."fibonacci2"(c)) as R(n) on c = n
{code}
{code}
Mappings$NoElementException: source #0 has no target in mapping [size=2, 
sourceCount=3, targetCount=2, elements=[1:0, 2:1]]
  at 
org.apache.calcite.util.mapping.Mappings$AbstractMapping.getTarget(Mappings.java:955)
  at 
org.apache.calcite.plan.RelOptUtil$RexCorrelVariableMapShuttle.visitFieldAccess(RelOptUtil.java:4727)
{code}
With {{select *}} the same query works 
({{TableFunctionTest.testLeftOuterApply}}).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to