Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-24007

EqualNullSafe for FloatType and DoubleType might generate a wrong result by codegen.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2, 2.1.2, 2.2.1, 2.3.0
    • Fix Version/s: 2.2.2, 2.3.1, 2.4.0
    • Component/s: SQL
    • Labels:

      Description

      EqualNullSafe for FloatType and DoubleType might generate a wrong result by codegen.

      scala> val df = Seq((Some(-1.0d), None), (None, Some(-1.0d))).toDF()
      df: org.apache.spark.sql.DataFrame = [_1: double, _2: double]
      
      scala> df.show()
      +----+----+
      |  _1|  _2|
      +----+----+
      |-1.0|null|
      |null|-1.0|
      +----+----+
      
      
      scala> df.filter("_1 <=> _2").show()
      +----+----+
      |  _1|  _2|
      +----+----+
      |-1.0|null|
      |null|-1.0|
      +----+----+
      

      The result should be empty but the result remains two rows.

        Attachments

          Activity

            People

            • Assignee:
              ueshin Takuya Ueshin
              Reporter:
              ueshin Takuya Ueshin
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: