Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/13469#discussion_r65643344
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoder.scala
---
@@ -52,8 +52,15 @@ object ExpressionEncoder {
val cls = mirror.runtimeClass(tpe)
val flat = !ScalaReflection.definedByConstructorParams(tpe)
- val inputObject = BoundReference(0, ScalaReflection.dataTypeFor[T],
nullable = false)
- val serializer = ScalaReflection.serializerFor[T](inputObject)
+ val inputObject = BoundReference(0, ScalaReflection.dataTypeFor[T],
nullable = true)
+ val nullSafeInput = if (flat) {
+ inputObject
+ } else {
+ // For input object of non-flat type, we can't encode it to row if
it's null, as Spark SQL
+ // doesn't allow row to be null, only its columns can be null.
--- End diff --
> ... doesn't allow top-level row to be null, ...
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]