sandeep-katta commented on a change in pull request #24176: [SPARK-27233] 
[SQL]DF schema should match with table schema when converted to table
URL: https://github.com/apache/spark/pull/24176#discussion_r268092033
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/types/ArrayType.scala
 ##########
 @@ -90,7 +90,7 @@ case class ArrayType(elementType: DataType, containsNull: 
Boolean) extends DataT
   override def sql: String = s"ARRAY<${elementType.sql}>"
 
   override private[spark] def asNullable: ArrayType =
-    ArrayType(elementType.asNullable, containsNull = true)
+    ArrayType(elementType.asNullable, containsNull)
 
 Review comment:
   My bad , I agree `asNullable` should return it as nullable, it cannot be 
decided based on the current DF. for e.g below use case will fail if we don't 
return as `true`
   `      val df = Seq(Some(Seq[Long](1L, 2L,3L)), None).toDF("seq")
         df.write.format("parquet").saveAsTable("testSchema");
         val df1 = Seq(Some(Seq(null)), None).toDF("seq")
         df1.write.format("parquet").mode("append").saveAsTable("testSchema")`
   
   BTW what do you mean by We need to revisit nullability (given the community 
discussion so far) in general, not only specifically for this one.
   
   I will close this PR and update this discussion in jira to close it as non 
issue

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to