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

'SEARCH(1, Sarg[IS NOT NULL])' should be simplified to 'TRUE'

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.34.0
    • 1.35.0
    • core

    Description

      The minimal reproducer is to construct a RexCall with RexUnknownAs.FALSE as below:

      SEARCH(1, Sarg[IS NOT NULL])
      

      After RexSimplify#simplifySearch, the final simplified result is IS NOT NULL(1), which should be TRUE more thoroughly.

      Also, the following RexCall with RexUnknownAs.TRUE:

      SEARCH(1, Sarg[IS NULL])
      

      Is simplified to IS NULL(1), which should be FALSE.

      Another two cases:

      The following RexCall with RexUnknownAs.UNKNOWN:

      SEARCH(1, Sarg[=])
      

      Is simplified to 1 IS NOT NULL OR NULL, which should be TRUE.

      The following RexCall with RexUnknownAs.UNKNOWN:

      SEARCH(1, Sarg[<>])
      

      Is simplified to 1 <> 1, which should be FALSE.

      Note that current simplified result is inconsistent with RexCall.isAlwaysFalse and isAlwaysTrue.

      Therefore, for the above two reasons, I think we need to simplify SEARCH operator with special sarg more thoroughly.

      Attachments

        Issue Links

          Activity

            People

              Runking Runkang He
              Runking Runkang He
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: