viirya commented on a change in pull request #35332:
URL: https://github.com/apache/spark/pull/35332#discussion_r793417115



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -310,13 +310,16 @@ abstract class CastBase extends UnaryExpression with 
TimeZoneAwareExpression wit
 
   protected def ansiEnabled: Boolean
 
+  protected def withDataType(dataType: DataType): CastBase
+
   // When this cast involves TimeZone, it's only resolved if the timeZoneId is 
set;
   // Otherwise behave like Expression.resolved.
   override lazy val resolved: Boolean =
     childrenResolved && checkInputDataTypes().isSuccess && (!needsTimeZone || 
timeZoneId.isDefined)
 
   override lazy val preCanonicalized: Expression = {
     val basic = 
withNewChildren(Seq(child.preCanonicalized)).asInstanceOf[CastBase]
+      .withDataType(dataType.asNullable)

Review comment:
       Is it possible that other kind of child's canonicalized format doesn't 
follow the canonicaliztion of AttributeReference on nullability change?




-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to