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

Alessandro Solimando commented on CALCITE-7011:
-----------------------------------------------

[~xuzifu666], since there are some open questions and the associated PR has 
been closed for now, let me remove the fix version. We can include it into the 
1.40.0 release in case it's finally ready.

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

Reply via email to