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

Confusing javadoc of RexSimplify.simplify

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Resolved
    • 1.28.0
    • 1.30.0
    • core

    Description

      Javadoc of RexSimplify.simplify says that

      simplify(x = 1 AND y = 2 AND NOT x = 1) returns y = 2
      

      but it is wrong for any policy:
      x <- 1
      y <- 2
      x = 1 AND y = 2 AND NOT x = 1 == false
      y = 2 == true

      I guess it should have been like

      simplify(y = 2 AND (x = 1 OR NOT x = 1 OR x IS NULL)) returns y = 2
      

      which is true for any policy:

      Origin:            AND(=($1, CAST(2):INTEGER), OR(=($0, CAST(1):INTEGER), NOT(=($0, CAST(1):INTEGER)), IS NULL($0)))
      Simplify(Unknown): =($1, 2)
      Simplify(False):   =($1, 2)
      Simplify(True):    =($1, 2)
      

      Attachments

        Issue Links

          Activity

            People

              nobigo xiong duan
              trushev Alexander Trushev
              Votes:
              0 Vote for this issue
              Watchers:
              6 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 - 1h
                  1h