peterxcli opened a new pull request, #5225: URL: https://github.com/apache/datafusion-comet/pull/5225
## Which issue does this PR close? Closes #5190. ## Rationale for this change `DecimalPrecision.promote` and `CometDivide.convert` both wrapped decimal `Divide` expressions in equivalent `CheckOverflow` nodes. The native planner does not collapse that shape, so successful decimal division could perform the same precision scan twice. Promotion can also run more than once when serializers such as `ArrayContains` recursively call the public `exprToProto` API. If decimal overflow wrapping is owned by `DecimalPrecision.promote`, the transformation therefore needs to be idempotent. ## What changes are included in this PR? - Make `DecimalPrecision.promote` collapse adjacent equivalent `CheckOverflow` wrappers around decimal binary arithmetic while preserving wrappers with different result types or overflow modes. - Remove the specialized decimal `CheckOverflow` creation from `CometDivide.convert`, keeping overflow wrapping centralized in decimal promotion. - Add a real-SQL proto regression through `array_contains` covering decimal Add, Subtract, Multiply, Divide, and Remainder, including LEGACY, TRY, and ANSI divide modes. - Update the existing per-expression eval-mode regression to expect a single decimal Divide wrapper. ## How are these changes tested? - `JAVA_HOME=/Users/lixucheng/.sdkman/candidates/java/17.0.14-zulu ./mvnw test -Pspark-4.1 -Dtest=none -Dsuites="org.apache.spark.sql.comet.CometDecimalArithmeticViewSuite"` - `JAVA_HOME=/Users/lixucheng/.sdkman/candidates/java/17.0.14-zulu ./mvnw test -Pspark-4.2 -Dtest=none -Dsuites="org.apache.spark.sql.comet.CometDecimalArithmeticViewSuite"` - `JAVA_HOME=/Users/lixucheng/.sdkman/candidates/java/17.0.14-zulu ./mvnw test -Pspark-3.4 -Dtest=none -Dsuites="org.apache.comet.CometSqlFileTestSuite decimal_div"` - `JAVA_HOME=/Users/lixucheng/.sdkman/candidates/java/17.0.14-zulu ./mvnw test -Pspark-4.2 -Dtest=none -Dsuites="org.apache.comet.CometSqlFileTestSuite decimal_div"` - `git diff --check` -- 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]
