[
https://issues.apache.org/jira/browse/CALCITE-4673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17375335#comment-17375335
]
Stanilovsky Evgeny edited comment on CALCITE-4673 at 7/6/21, 9:12 AM:
----------------------------------------------------------------------
[~zabetak] thanks for pointing, i append additional test, as you told - into
TableFunctionTest, it fails without my changes and passed with fix. It contains
dummy request like :
{noformat}
select x, (select * from table (s.dummyTableFuncWithTwoParams(x, x))) from
(values (2), (4)) as t (x)
{noformat}
hope now its ok for reviewing and possibly merging?
Exception thrown without fix :
{noformat}
Correlation variable $cor0 should be defined
java.lang.AssertionError: Correlation variable $cor0 should be defined
at
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.getCorrelVariableGetter(EnumerableRelImplementor.java:472)
at
org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitFieldAccess(RexToLixTranslator.java:1367)
at
org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitFieldAccess(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexFieldAccess.accept(RexFieldAccess.java:94)
at
org.apache.calcite.adapter.enumerable.RexToLixTranslator.implementCallOperand(RexToLixTranslator.java:1177)
at
org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:1164)
at
org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexCall.accept(RexCall.java:189)
at
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:255)
at
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:243)
at
org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:239)
at
org.apache.calcite.adapter.enumerable.EnumerableTableFunctionScan.defaultTableFunctionImplement(EnumerableTableFunctionScan.java:129)
at
org.apache.calcite.adapter.enumerable.EnumerableTableFunctionScan.implement(EnumerableTableFunctionScan.java:74)
at
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:104)
at
org.apache.calcite.adapter.enumerable.EnumerableAggregate.implement(EnumerableAggregate.java:105)
at
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:104)
at
org.apache.calcite.adapter.enumerable.EnumerableNestedLoopJoin.implement(EnumerableNestedLoopJoin.java:160)
at
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:111)
at
org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:113)
at
org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1130)
{noformat}
was (Author: zstan):
[~zabetak] thanks for pointing, i append additional test, as you told - into
TableFunctionTest, it fails without my changes and passed with fix. It contains
dummy request like :
{noformat}
select x, (select * from table (s.dummyTableFuncWithTwoParams(x, x))) from
(values (2), (4)) as t (x)
{noformat}
hope now its ok for reviewing and possibly merging?
> Correlate variables deduplication is not triggered when custom table function
> presented.
> ----------------------------------------------------------------------------------------
>
> Key: CALCITE-4673
> URL: https://issues.apache.org/jira/browse/CALCITE-4673
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.27.0
> Reporter: Stanilovsky Evgeny
> Assignee: Stanilovsky Evgeny
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.28.0
>
> Attachments: code-sample-UDF-in-quidem.patch
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> request like:
> {noformat}
> select e.deptno, (select * from lateral table(DEDUP(e.deptno, e.deptno)))
> from emp e;
> {noformat}
> shows 2 different correlates, while it only one.
> {noformat}
> LogicalProject(DEPTNO=[$7], EXPR$1=[$SCALAR_QUERY({
> LogicalProject(NAME=[$0])
> LogicalTableFunctionScan(invocation=[DEDUP($cor0.DEPTNO, $cor1.DEPTNO)],
> rowType=[RecordType(VARCHAR(1024) NAME)])
> })])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {noformat}
> [dev-list
> discussion|https://lists.apache.org/thread.html/re20d580a979585ae946d61df80a345c70ae2b5a92577a8b5db1e2c50%40<dev.calcite.apache.org>]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)