Vivek1106-04 commented on code in PR #59437:
URL: https://github.com/apache/spark/pull/59437#discussion_r4577451333


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala:
##########
@@ -480,17 +480,23 @@ case class Add(
     copy(left = newLeft, right = newRight)
 
   override lazy val canonicalized: Expression = {
-    val reorderResult = buildCanonicalizedPlan(
-      { case Add(l, r, em) if em == evalContext => Seq(l, r) },
-      { case (l: Expression, r: Expression) => Add(l, r, evalContext)},
-      Some(evalContext)
-    )
-    if (resolved && reorderResult.resolved && reorderResult.dataType == 
dataType) {
-      reorderResult
+    if (resolved && (dataType == FloatType || dataType == DoubleType)) {

Review Comment:
   Done in a405f52. `Add` and `Multiply` whose result is a 38-digit DECIMAL now 
take the per-operator path too (`BinaryArithmetic.isNonAssociative`); chains 
below 38 digits keep re-associating and building `MultiCommutativeOp`. I added 
decimal cases to the canonicalization, subexpression elimination, cache and 
GROUP BY tests, rebuilt the percentile guard fixtures on a test-only expression 
that is canonically equal but evaluates differently, and extended the migration 
note. Removing either guard, or limiting the condition to FLOAT/DOUBLE, makes a 
test fail.



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