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

nullability of GetArrayStructFields is incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 1.6.3, 2.0.2, 2.1.3, 2.2.3, 2.3.4, 2.4.6, 3.0.0
    • 2.4.7, 3.0.1, 3.1.0
    • SQL

    Description

      The following should be `Array([WrappedArray(1, null)])` instead of `Array([WrappedArray(1, 0)])`

      import scala.collection.JavaConverters._
      import org.apache.spark.sql.Row
      import org.apache.spark.sql.types.{ArrayType, StructType}
      
      val innerStruct = new StructType().add("i", "int", nullable = true)
      val schema = new StructType().add("arr", ArrayType(innerStruct, containsNull = false))
      val df = spark.createDataFrame(List(Row(Seq(Row(1), Row(null)))).asJava, schema)
      df.select($"arr".getField("i")).collect
      

       

      Attachments

        Activity

          People

            cloud_fan Wenchen Fan
            cloud_fan Wenchen Fan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: