-
- Downloads
[SPARK-14139][SQL] RowEncoder should preserve schema nullability
## What changes were proposed in this pull request? The problem is: In `RowEncoder`, we use `Invoke` to get the field of an external row, which lose the nullability information. This PR creates a `GetExternalRowField` expression, so that we can preserve the nullability info. TODO: simplify the null handling logic in `RowEncoder`, to remove so many if branches, in follow-up PR. ## How was this patch tested? new tests in `RowEncoderSuite` Note that, This PR takes over https://github.com/apache/spark/pull/11980, with a little simplification, so all credits should go to koertkuipers Author: Wenchen Fan <wenchen@databricks.com> Author: Koert Kuipers <koert@tresata.com> Closes #12364 from cloud-fan/nullable.
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/RowEncoder.scala 21 additions, 15 deletions...a/org/apache/spark/sql/catalyst/encoders/RowEncoder.scala
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects.scala 42 additions, 0 deletions...a/org/apache/spark/sql/catalyst/expressions/objects.scala
- sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/encoders/RowEncoderSuite.scala 8 additions, 0 deletions.../apache/spark/sql/catalyst/encoders/RowEncoderSuite.scala
- sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala 17 additions, 1 deletion...re/src/test/scala/org/apache/spark/sql/DatasetSuite.scala
Please register or sign in to comment