[
https://issues.apache.org/jira/browse/CALCITE-7011?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yu Xu closed CALCITE-7011.
--------------------------
Resolution: Won't Fix
> 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
> Priority: Major
> Labels: pull-request-available
>
> 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(in this case in would transform to
> multiple OR), 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)