joelrobin18 commented on code in PR #59954:
URL: https://github.com/apache/spark/pull/59954#discussion_r4463270942
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala:
##########
@@ -273,19 +273,23 @@ object ConstantPropagation extends Rule[LogicalPlan] {
* Reorder associative integral-type operators and fold all constants into one.
*/
object ReorderAssociativeOperator extends Rule[LogicalPlan] {
+ // Flatten only operators evaluated in the same mode as the root: rebuilding
a TRY-mode Add or
+ // Multiply (try_add, try_multiply) in the enclosing mode would change its
overflow behavior.
private def flattenAdd(
expression: Expression,
- groupSet: ExpressionSet): Seq[Expression] = expression match {
- case expr @ Add(l, r, _) if !groupSet.contains(expr) =>
- flattenAdd(l, groupSet) ++ flattenAdd(r, groupSet)
+ groupSet: ExpressionSet,
+ evalContext: NumericEvalContext): Seq[Expression] = expression match {
+ case expr @ Add(l, r, c) if c == evalContext && !groupSet.contains(expr) =>
Review Comment:
Addressed by the verified self-fix.
<!-- SPARK_DEV_REVIEW_REPLY
{"finding_ids":["pass-b:P2B-1"],"thread_id":"inline:4444272141","verdict_sha256":"31daf46defd6783a653a77cde04c1d5526e777b01159160364875cd74bea39cb"}
-->
--
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]