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



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/UnwrapCastInBinaryComparison.scala
##########
@@ -306,7 +306,12 @@ object UnwrapCastInBinaryComparison extends 
Rule[LogicalPlan] {
     // decimal type), or that the literal `value` is within range `(min, 
max)`. For these, we
     // optimize by moving the cast to the literal side.
 
-    val newValue = Cast(Literal(value), fromType).eval()
+    val newValue = try {
+      Cast(Literal(value), fromType).eval()

Review comment:
       can we create a non-ANSI cast here? `Cast(Literal(value), fromType, 
ansiEnabled = false).eval()`




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