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

compare of -0.0 < 0.0 return true

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.0, 3.0.1
    • 3.0.2, 3.1.0
    • SQL

    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. 2.4_codegen.txt
          2 kB
          Sandeep Katta
        2. 3.0_Codegen.txt
          2 kB
          Sandeep Katta

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: