HyukjinKwon commented on a change in pull request #27991: [SPARK-31227][SQL] Non-nullable null type in complex types should not coerce to nullable type URL: https://github.com/apache/spark/pull/27991#discussion_r396835748
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala ########## @@ -77,7 +77,8 @@ object Cast { resolvableNullability(fn || forceNullable(fromType, toType), tn) case (MapType(fromKey, fromValue, fn), MapType(toKey, toValue, tn)) => - canCast(fromKey, toKey) && canCastMapKeyNullSafe(fromKey, toKey) && + canCast(fromKey, toKey) && + (!forceNullable(fromKey, toKey)) && Review comment: This one was a clean revert from this line (https://github.com/apache/spark/commit/d7b97a1d0daf65710317321490a833f696a46f21#diff-258b71121d8d168e4d53cb5b6dc53ffeL81). I would keep this line as is .. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org