You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Volodymyr Vysotskyi (JIRA)" <ji...@apache.org> on 2017/11/27 13:13:00 UTC

[jira] [Created] (CALCITE-2066) RelOptUtil.splitJoinCondition() could not split condition with case after applying FilterReduceExpressionsRule

Volodymyr Vysotskyi created CALCITE-2066:
--------------------------------------------

             Summary: RelOptUtil.splitJoinCondition() could not split condition with case after applying FilterReduceExpressionsRule
                 Key: CALCITE-2066
                 URL: https://issues.apache.org/jira/browse/CALCITE-2066
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Volodymyr Vysotskyi
            Assignee: Julian Hyde


Query 
{code:sql}
select * from emp a emp b where coalesce(a.mgr, -1) = coalesce(b.mgr, -1)
{code}
has logical plan
{noformat}
LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], EMPNO0=[$9], ENAME0=[$10], JOB0=[$11], MGR0=[$12], HIREDATE0=[$13], SAL0=[$14], COMM0=[$15], DEPTNO0=[$16], SLACKER0=[$17])
  LogicalFilter(condition=[=(CASE(IS NOT NULL($3), $3, -1), CASE(IS NOT NULL($12), $12, -1))])
    LogicalJoin(condition=[true], joinType=[inner])
      LogicalTableScan(table=[[CATALOG, SALES, EMP]])
      LogicalTableScan(table=[[CATALOG, SALES, EMP]])
{noformat}
After applying {{FilterReduceExpressionsRule}} condition in filter is changed to
{noformat}
CASE(IS NOT NULL($12), CASE(IS NOT NULL($3), =($3, $12), =(-1, $12)), CASE(IS NOT NULL($3), =($3, -1), CAST(true):BOOLEAN))
{noformat}

When this condition is passed into {{RelOptUtil.splitJoinCondition()}} method, {{leftJoinKeys}} and  {{rightJoinKeys}} lists are left empty and passed condition is returned.

*Note:* {{RelOptUtil.splitJoinCondition()}} works correctly for the initial condition without applying {{FilterReduceExpressionsRule}}.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)