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

Incorrect simplification for 'NaN' value

    XMLWordPrintableJSON

Details

    Description

      RexSimplify simplifies x = x to null or x is not null (similarly <= and >=), and x != x to null and x is null (similarly < and >).
      https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rex/RexSimplify.java#L363

      This may not be applicable in some cases. For instance, if the type of x is floating-point, x could be 'NaN'. While some RDBMS consider 'NaN' = 'NaN' (e.g., Postgres), some others consider 'NaN' != 'NaN' following the IEEE 754 standard. For the latest, the rewriting above will result in incorrect results.

      I think we should simply ignore this simplification for floating-point type.

      Attachments

        Issue Links

          Activity

            People

              jcamacho Jesús Camacho Rodríguez
              jcamacho Jesús Camacho Rodríguez
              Votes:
              0 Vote for this issue
              Watchers:
              2 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