andygrove opened a new pull request, #7652: URL: https://github.com/apache/datafusion-comet/pull/7652
## Which issue does this PR close? Backport of #7379 to `branch-1.2`. Closes #7378 on this branch. ## Rationale for this change With ANSI mode disabled, Spark returns `NULL` for `try_add(a, b) + b` when the inner addition overflows. `branch-1.2` flattens both additions into one balanced tree that uses the outer operation's wrapping overflow behavior, so it returns a wrapped integer instead. The same problem affects `try_multiply` inside a multiplication. See #7379 and #7378 for the full analysis. ## What changes are included in this PR? Cherry-pick of 268ede5a63 (`git cherry-pick -x`) with no conflicts and no adaptations. Flattening in `CometAdd` and `CometMultiply` now stops at a nested `Add` or `Multiply` whose `evalMode` differs from the outer one, and the source PR's `arithmetic.sql` case is included. The diff against the source commit is identical apart from line numbers and blob hashes. Other release branches: `branch-1.2` is the newest release branch, so there is no newer one to port to. ## How are these changes tested? On this branch, with JDK 17 and the default Spark profile only: `CometSqlFileTestSuite` for `arithmetic.sql`, `arithmetic_ansi.sql` and `arithmetic_try.sql` passes against a native library built from this branch (3 tests, 0 failures). With `arithmetic.scala` restored to `branch-1.2`'s version, `arithmetic.sql` fails (the other two still pass), so the branch has the bug and the test catches it. -- 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]
