sunchao commented on a change in pull request #34888:
URL: https://github.com/apache/spark/pull/34888#discussion_r768290567
##########
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()
+ } catch {
+ case _: ArithmeticException => null
Review comment:
nit: it'd be great if we can add some comments here
--
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]