Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2257

Combination of predicates can be proved to be always true

    XMLWordPrintableJSON

Details

    Description

      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.

      select SAL from EMPNULLABLES_20 where SAL IS NOT NULL OR SAL is null
      
      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]])
      

      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.

      Attachments

        Issue Links

          Activity

            People

              vitalii Vitalii Diravka
              vitalii Vitalii Diravka
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m