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

'a = 0 or a is null' should not be rewrite to a sarg 'a in (0, null)'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.26.0
    • 1.27.0
    • core
    • None

    Description

      SQL statements:

      a = 0 or a is null -- returns true when a is null
      
      a in (0, null) -- returns null when a is null
      

      have different semantics when a is null, we should not represent it as a sarg after RexSimplify,

      check this test in RexProgramTest:

      @Test void testSimplifyInOr() {
              or(
                  gt(vInt(), literal(0)),
                  isNull(vInt())),
              ">(?0.int0, 0)");
        }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              danny0405 Danny Chen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: