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

compare of -0.0 < 0.0 return true

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0, 3.0.1
    • Fix Version/s: 3.0.2, 3.1.0
    • Component/s: SQL
    • Labels:
    • Target Version/s:

      Description

       val spark: SparkSession = SparkSession
            .builder()
            .master("local")
            .appName("SparkByExamples.com")
            .getOrCreate()
          spark.sparkContext.setLogLevel("ERROR")
      
          import spark.sqlContext.implicits._
      
          val df = Seq((-0.0, 0.0)).toDF("neg", "pos")
            .withColumn("comp", col("neg") < col("pos"))
            df.show(false)
      
      ======
      
      +----+---+----+
      |neg |pos|comp|
      +----+---+----+
      |-0.0|0.0|true|
      +----+---+----+

      I think that result should be false.

      *Apache Spark 2.4.6 RESULT*

      scala> spark.version
      res0: String = 2.4.6
      
      scala> Seq((-0.0, 0.0)).toDF("neg", "pos").withColumn("comp", col("neg") < col("pos")).show
      +----+---+-----+
      | neg|pos| comp|
      +----+---+-----+
      |-0.0|0.0|false|
      +----+---+-----+
      

        Attachments

        1. 3.0_Codegen.txt
          2 kB
          Sandeep Katta
        2. 2.4_codegen.txt
          2 kB
          Sandeep Katta

          Issue Links

            Activity

              People

              • Assignee:
                cloud_fan Wenchen Fan
                Reporter:
                igreenfi Izek Greenfield
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: