-
- Downloads
[SPARK-18251][SQL] the type of Dataset can't be Option of non-flat type
## What changes were proposed in this pull request? For input object of non-flat type, we can't encode it to row if it's null, as Spark SQL doesn't allow the entire row to be null, only its columns can be null. That's the reason we forbid users to use top level null objects in https://github.com/apache/spark/pull/13469 However, if users wrap non-flat type with `Option`, then we may still encoder top level null object to row, which is not allowed. This PR fixes this case, and suggests users to wrap their type with `Tuple1` if they do wanna top level null objects. ## How was this patch tested? new test Author: Wenchen Fan <wenchen@databricks.com> Closes #15979 from cloud-fan/option.
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala 13 additions, 0 deletions...scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoder.scala 12 additions, 2 deletions...pache/spark/sql/catalyst/encoders/ExpressionEncoder.scala
- sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala 11 additions, 2 deletions...re/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
- sql/core/src/test/scala/org/apache/spark/sql/JsonFunctionsSuite.scala 1 addition, 1 deletion.../test/scala/org/apache/spark/sql/JsonFunctionsSuite.scala
Please register or sign in to comment