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

Datasets generate random values for null primitive types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1.1, 2.2.0
    • 2.2.1, 2.3.0
    • SQL

    Description

      Not sure if it ever were reported.

      scala> val s = sc.parallelize(Seq[Option[Long]](None,Some(1L),Some(5))).toDF("v")
      s: org.apache.spark.sql.DataFrame = [v: bigint]
      
      scala> s.show(false)
      +----+
      |v   |
      +----+
      |null|
      |1   |
      |5   |
      +----+
      
      
      scala> s.as[Long].map(v => v*2).show(false)
      +-----+
      |value|
      +-----+
      |-2   |
      |2    |
      |10   |
      +-----+
      
      
      scala> s.select($"v"*2).show(false)
      +-------+
      |(v * 2)|
      +-------+
      |null   |
      |2      |
      |10     |
      +-------+
      

      Attachments

        Activity

          People

            cloud_fan Wenchen Fan
            kuzemchik Vladislav Kuzemchik
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: