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

Regression in IntegralDivide returning null instead of 0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.4.0
    • SQL
    • None

    Description

      There seems to be a regression in Spark 3.4 Integral Divide

       

      scala> val df = Seq("0.5944910","0.3314242").toDF("a")
      df: org.apache.spark.sql.DataFrame = [a: string]
      
      scala> df.selectExpr("cast(a as decimal(7,7)) div 100").show
      +---------------------------------+
      |(CAST(a AS DECIMAL(7,7)) div 100)|
      +---------------------------------+
      |                             null|
      |                             null|
      +---------------------------------+
      

       

      While in Spark 3.3.0

      scala> val df = Seq("0.5944910","0.3314242").toDF("a")
      df: org.apache.spark.sql.DataFrame = [a: string]
      
      scala> df.selectExpr("cast(a as decimal(7,7)) div 100").show
      +---------------------------------+
      |(CAST(a AS DECIMAL(7,7)) div 100)|
      +---------------------------------+
      |                                0|
      |                                0|
      +---------------------------------+
      

       

      Attachments

        Activity

          People

            ulysses XiDuo You
            razajafri Raza Jafri
            Robert Joseph Evans Robert Joseph Evans
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: