[ 
https://issues.apache.org/jira/browse/CALCITE-4673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17374679#comment-17374679
 ] 

Stamatis Zampetakis commented on CALCITE-4673:
----------------------------------------------

[~zstan] I think what you did (adding a test in {{RelToSqlConverterTest}}) 
totally makes sense so maybe you don't need to add more test cases in the end.

To complete the discussion and answer your questions the error that you get 
comes from the fact that there is no {{DEDUP}} function registered in the 
schema that you are using in {{sub-query.iq}}. I checked a bit and it is true 
that currently we don't have Quidem tests around user defined table functions. 
If you want to add such tests you have to register somehow the UDF to be able 
to use it in Quidem (e.g.,  [^code-sample-UDF-in-quidem.patch] ). Still the 
example that I attached is not sufficient to actually execute the plan since it 
needs a bit more code to make that happen.

Another place for adding tests with table functions is {{TableFunctionTest}}. 
Maybe there it would be easier to add an end-to-end test to better illustrate 
the problem.

> 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
>         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)

Reply via email to