Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10283#discussion_r47506653
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/ScalaReflection.scala 
---
    @@ -421,46 +439,75 @@ object ScalaReflection extends ScalaReflection {
         if (!inputObject.dataType.isInstanceOf[ObjectType]) {
           inputObject
         } else {
    +      val className = getClassNameFromType(tpe)
           tpe match {
             case t if t <:< localTypeOf[Option[_]] =>
               val TypeRef(_, _, Seq(optType)) = t
               optType match {
                 // For primitive types we must manually unbox the value of the 
object.
                 case t if t <:< definitions.IntTpe =>
    -              Invoke(
    -                UnwrapOption(ObjectType(classOf[java.lang.Integer]), 
inputObject),
    -                "intValue",
    -                IntegerType)
    +              val unwrapped = 
UnwrapOption(ObjectType(classOf[java.lang.Integer]), inputObject)
    +              expressions.If(
    +                IsNull(unwrapped),
    +                expressions.Literal.create(null, 
silentSchemaFor(optType).dataType),
    +                Invoke(
    +                  unwrapped,
    --- End diff --
    
    I think you are right. I add this to make sure it is not possibly creating 
wrong values when I debug. I will remove these `If`.


---
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]

Reply via email to