feat: Add native support for scalar Math expressions#4028
Open
pchintar wants to merge 1 commit intoapache:mainfrom
Open
feat: Add native support for scalar Math expressions#4028pchintar wants to merge 1 commit intoapache:mainfrom
pchintar wants to merge 1 commit intoapache:mainfrom
Conversation
Author
|
This is weird, The only failing CI test is TestRewriteDataFilesAction.testParallelPartialProgressWithMaxFailedCommitsLargerThanTotalFileGroup() in the Iceberg Spark 3.4 / Scala 2.13 job. I investigated it separately and reproduced that targeted test locally with ENABLE_COMET=true multiple times, and it passed each time. So I have not been able to reproduce the failure outside CI. From the artifacts available to me, I can only see the outer Iceberg partial-progress wrapper exception, not the inner commit-failure cause. Since this failure is outside the scalar expression changes made in this PR, could you please rerun the failed job or share any more other test-report feedback if possible? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #3840 .
Rationale for this change
Several scalar mathematical expressions are currently unsupported in Comet and fall back to Spark JVM execution. This PR adds native support for these expressions to improve coverage while preserving full semantic parity with Spark, including correct handling of nulls and edge cases.
What changes are included in this PR?
Native support is added for the following expressions:
pi,e,degrees,radianssec,csc,cbrt,hypotfactorial,shiftrightunsignedImplementation and integration
Native implementations
native/spark-expr/src/math_funcs/math_expr.rsFunction registration
native/spark-expr/src/comet_scalar_funcs.rsModule exports
native/spark-expr/src/math_funcs/mod.rsnative/spark-expr/src/lib.rsSpark → Comet expression mapping
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scalaThese changes ensure the expressions are resolved and executed natively without fallback.
How are these changes tested?
Tests are added/extended in:
spark/src/test/scala/org/apache/comet/CometExpressionSuite.scalaAdded
sec,csc,cbrt,hypotto existing math coverageAdded dedicated tests for:
factorialshiftrightunsigned(bothInt32andInt64)piandedegreesandradiansvalidated via existing scalar test patternsAll tests verify:
All tests pass successfully.