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

    https://github.com/apache/spark/pull/13401#discussion_r65146228
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
 ---
    @@ -721,8 +716,55 @@ case class GetExternalRowField(
               "cannot be null.");
           }
     
    -      final ${ctx.javaType(dataType)} ${ev.value} = $getField;
    +      final Object ${ev.value} = ${row.value}.get($index);
          """
         ev.copy(code = code, isNull = "false")
       }
     }
    +
    +/**
    + * Validates the actual data type of input expression at runtime.  If it 
doesn't match the
    + * expectation, throw an exception.
    + */
    +case class ValidateExternalType(child: Expression, expected: DataType)
    --- End diff --
    
    Previously we completely rely on the correctness of provided schema. If the 
data doesn't match provided schema, we should see value converting error. I 
think this `ValidateExternalType` can improve the experience of error handling. 
However, it looks like a performance regression as we do extra checking here. 
If we can trust the provided schema, should we do this checking?


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