pchintar opened a new pull request, #4028:
URL: https://github.com/apache/datafusion-comet/pull/4028
## 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`, `radians`
* `sec`, `csc`, `cbrt`, `hypot`
* `factorial`, `shiftrightunsigned`
### Implementation and integration
* **Native implementations**
* Added in:
`native/spark-expr/src/math_funcs/math_expr.rs`
* **Function registration**
* Updated:
`native/spark-expr/src/comet_scalar_funcs.rs`
* **Module exports**
* Updated:
`native/spark-expr/src/math_funcs/mod.rs`
`native/spark-expr/src/lib.rs`
* **Spark → Comet expression mapping**
* Updated:
`spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala`
These 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.scala`
* Added `sec`, `csc`, `cbrt`, `hypot` to existing math coverage
* Added dedicated tests for:
* `factorial`
* `shiftrightunsigned` (both `Int32` and `Int64`)
* `pi` and `e`
* `degrees` and `radians` validated via existing scalar test patterns
All tests verify:
* correctness against Spark results
* native execution (no fallback)
All tests pass successfully.
--
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]