ulysses-you commented on code in PR #38513:
URL: https://github.com/apache/spark/pull/38513#discussion_r1014959493


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala:
##########
@@ -481,12 +481,12 @@ case class Add(
     // TODO: do not reorder consecutive `Add`s with different `evalMode`
     val reorderResult =
       orderCommutative({ case Add(l, r, _) => Seq(l, r) }).reduce(Add(_, _, 
evalMode))
-    if (resolved && reorderResult.resolved && reorderResult.dataType == 
dataType) {
-      reorderResult
+    if (resolved && reorderResult.resolved && reorderResult.dataType != 
dataType) {

Review Comment:
   for safe, can we do this for decimal type only ? e.g
   ```scala
   left match {
     case _: DecimalType if resolved && reorderResult.resolved && 
reorderResult.dataType != dataType =>
       Cast(reorderResult, dataType)
     case _ => reorderResult
   }
   ```
   



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