Yu Xu created CALCITE-7011:
------------------------------

             Summary: Filter conditions should be distinct avoid duplicate 
condition
                 Key: CALCITE-7011
                 URL: https://issues.apache.org/jira/browse/CALCITE-7011
             Project: Calcite
          Issue Type: New Feature
          Components: core
    Affects Versions: 1.39.0
            Reporter: Yu Xu
            Assignee: Yu Xu
             Fix For: 1.40.0


sql:
{code:java}
select deptno from emp where deptno=1 or deptno in (1,2) {code}
currently would convert to a plan:
{code:java}
LogicalProject(DEPTNO=[$7])
  LogicalFilter(condition=[OR(=($7, 1), =($7, 1), =($7, 2))])
    LogicalTableScan(table=[[CATALOG, SALES, EMP]]) {code}
we can find that ($7, 1) is duplicate, we should distinct the conditions as:
{code:java}
LogicalProject(DEPTNO=[$7])
  LogicalFilter(condition=[SEARCH($7, Sarg[1, 2])])
    LogicalTableScan(table=[[CATALOG, SALES, EMP]]) {code}
maybe we can add a new rule to resolve the issue.



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

Reply via email to