stefankandic commented on code in PR #58779:
URL: https://github.com/apache/spark/pull/58779#discussion_r4017896992


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullExpressions.scala:
##########
@@ -187,8 +187,18 @@ private case class TypedNullLiteral(child: Expression)
 
   override lazy val replacement: Expression = Literal.create(null, 
child.dataType)
 
-  override protected def withNewChildInternal(newChild: Expression): 
TypedNullLiteral =
-    copy(child = newChild)
+  override protected def withNewChildInternal(newChild: Expression): 
Expression =
+    TypedNullLiteral.create(newChild)
+}
+
+private object TypedNullLiteral {
+  def create(child: Expression): Expression = {
+    if (child.resolved) {
+      Literal.create(null, child.dataType)

Review Comment:
   IfTypeCoercion now synchronizes TypedNullLiteral with the coerced return 
branch. For With, definitions are transformed first so references have the 
updated type before coercing the body. Added regression coverage for ANSI and 
inline settings.



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