[ 
https://issues.apache.org/jira/browse/CALCITE-2257?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zoltan Haindrich resolved CALCITE-2257.
---------------------------------------
    Resolution: Fixed

I'm closing this because I think right now simplification is already able to 
handle these cases.
{code}
  @Test public void testSimplify1() {
    checkSimplify(or(isNotNull(vInt()), isNull(vInt())), "true");
  }
{code}
there are also some 
[tests|https://github.com/apache/calcite/blob/564caac262e43d7c27397d7bd17ab0f1689fdf4d/core/src/test/java/org/apache/calcite/test/RexProgramTest.java#L1610]

Please reopen if disagree!

> Combination of predicates can be proved to be always true
> ---------------------------------------------------------
>
>                 Key: CALCITE-2257
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2257
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.16.0
>            Reporter: Vitalii Diravka
>            Assignee: Vitalii Diravka
>            Priority: Major
>              Labels: filter, pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> I have found the case, when Filter operator is not necessary since filter 
> condition is always true, but that is not detected by current version of 
> Calcite.
> {code}
> select SAL from EMPNULLABLES_20 where SAL IS NOT NULL OR SAL is null
> {code}
> {code}
> LogicalProject(SAL=[$5])
>   LogicalFilter(condition=[OR(IS NOT NULL($5), IS NULL($5))])
>     LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], 
> SAL=[$5], COMM=[$6], SLACKER=[$8])
>       LogicalFilter(condition=[AND(=($7, 20), >($5, 1000))])
>         LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])
> {code}
> But filter condition _OR(IS NOT NULL($5), IS NULL($5))_ can be proved to be 
> always true.
> I have tried _ReduceExpressionsRule_, but it doesn't give effect.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to