cloud-fan commented on a change in pull request #33146:
URL: https://github.com/apache/spark/pull/33146#discussion_r661973792



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -406,19 +406,21 @@ abstract class CastBase extends UnaryExpression with 
TimeZoneAwareExpression wit
         if (row.numFields > 0) {
           val st = fields.map(_.dataType)
           val toUTF8StringFuncs = st.map(castToString)
-          if (row.isNullAt(0)) {
+          if (fields(0).nullable && row.isNullAt(0)) {

Review comment:
       Then we need to fix the nullability. There are so many places in the 
Spark codebase that relies on nullability to do optimizations. It's not 
possible to change all of them to not trust the nullability anymore.
   
   Can we fix `spark.read.json()` to set the nullability correctly?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to