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



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CanonicalizeSuite.scala
##########
@@ -177,4 +177,18 @@ class CanonicalizeSuite extends SparkFunSuite {
     assert(expr.semanticEquals(attr))
     assert(attr.semanticEquals(expr))
   }
+
+  test("SPARK-38030: Canonicalize Cast should remove nullability of target 
dataType") {
+    val structType = StructType(Seq(StructField("name", StringType, nullable = 
false)))
+    val attr = AttributeReference("col", structType)()
+    for (cast <- Seq(
+        Cast(attr, structType),
+        AnsiCast(attr, structType),
+        TryCast(attr, structType))) {
+      assert(cast.resolved)
+      // canonicalization should not converted resolved cast to unresolved
+      assert(cast.canonicalized.resolved)

Review comment:
       Yah I think the current test is probably sufficient.




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