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

Jiajun Xie commented on CALCITE-5985:
-------------------------------------

I can't find any unit tests for FilterTableFunctionTransposeRule.

 

And I write a unit test to match it.

 
{code:java}
@Test void testFilterTableFunctionScanTranspose() {
  HepProgram program = new HepProgramBuilder()
      .addRuleInstance(CoreRules.FILTER_TABLE_FUNCTION_TRANSPOSE)
      .build();

  final String sql = "select * from table(dedup(cursor(select ename from emp), 
cursor(select name from dept), 'NAME')) where name = ''";
  sql(sql)
      .withProgram(program).check();
} {code}
Th planBefore is 

 

 
{code:java}
LogicalProject(NAME=[$0])
  LogicalFilter(condition=[=($0, '')])
    LogicalTableFunctionScan(invocation=[DEDUP(CAST($0):CURSOR NOT NULL, 
CAST($1):CURSOR NOT NULL, 'NAME')], rowType=[RecordType(VARCHAR(1024) NAME)])
      LogicalProject(ENAME=[$1])
        LogicalTableScan(table=[[CATALOG, SALES, EMP]])
      LogicalProject(NAME=[$1])
        LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
 {code}
But FilterTableFunctionTransposeRule will return.
{code:java}
Set<RelColumnMapping> columnMappings = funcRel.getColumnMappings();
if (columnMappings == null || columnMappings.isEmpty()) {
  // No column mapping information, so no push-down
  // possible.
  return;
}{code}
[~scarlin] , Do you have any unit tests?

 

> FilterTableFunctionTransposeRule should not use "Logical" RelNodes
> ------------------------------------------------------------------
>
>                 Key: CALCITE-5985
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5985
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Steve Carlin
>            Priority: Major
>
> The FilterTableFunctionTransposeRule uses LogicalTableFunctionScan and 
> LogicalFilter RelNodes in its rule.  We should be using the appropriate 
> TableFunctionScan and Filter interface RelNodes instead. 



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

Reply via email to