Github user dongjoon-hyun commented on a diff in the pull request:
https://github.com/apache/spark/pull/19707#discussion_r150026840
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala
---
@@ -134,7 +134,13 @@ object ScalaReflection extends ScalaReflection {
val tpe = localTypeOf[T]
val clsName = getClassNameFromType(tpe)
val walkedTypePath = s"""- root class: "$clsName"""" :: Nil
- deserializerFor(tpe, None, walkedTypePath)
+ val expr = deserializerFor(tpe, None, walkedTypePath)
+ val Schema(_, nullable) = schemaFor(tpe)
+ if (nullable) {
+ expr
+ } else {
+ AssertNotNull(expr, walkedTypePath)
+ }
--- End diff --
Hi, @cloud-fan .
It looks great. Can we add a test case in `ScalaReflectionSuite`, too?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]