cloud-fan commented on code in PR #40190:
URL: https://github.com/apache/spark/pull/40190#discussion_r1130941590


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/UnwrapCastInBinaryComparison.scala:
##########
@@ -113,7 +114,7 @@ object UnwrapCastInBinaryComparison extends 
Rule[LogicalPlan] {
     // literal and cast side, then process the result and swap the literal and 
cast again to
     // restore the original order.
     case BinaryComparison(Literal(_, literalType), Cast(fromExp, toType, _, _))
-        if canImplicitlyCast(fromExp, toType, literalType) =>
+        if needToCanonicalizeExpression(fromExp, toType, literalType) =>

Review Comment:
   I see, maybe it's better if `unwrapCast` returns `Option[Expression]`, then 
here we can just do `unwrapCast(swap(exp)).map(swap)`, and the caller side can 
do `unwrapCast(e).getOrElse(e)`



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