zhangfengcdt opened a new pull request, #6556:
URL: https://github.com/apache/datafusion-comet/pull/6556

   ## Which issue does this PR close?
   
   Closes #6522
   
   ## Rationale for this change
   
   `signum(-0.0)` returns `0.0` in Comet where Spark returns `-0.0`. Spark's 
`Signum` calls `java.lang.Math.signum`, which returns the zero it is given. 
Comet mapped `Signum` to DataFusion's `signum`, which returns `0.0` for both 
zeros. 
   
   ## What changes are included in this PR?
   
   - `spark_signum`, a Comet kernel that returns the input for a zero and the 
sign otherwise. Rust's `f64::signum` returns `1.0` and `-1.0` for the two 
zeros, so the zero case is handled explicitly. NaN stays NaN.
   - `CometSignum`, a serde that targets the new kernel, following `CometSqrt`, 
which exists for the same reason. It accepts `DoubleType` only, so interval 
inputs now fall back instead of failing.
   - The `signum` entry is removed from `knownGaps` in 
`CometFloatSemanticsSuite`.
   - The expression audit entry for `signum` records the change.
   
   ## How are these changes tested?
   
   - `CometFloatSemanticsSuite`: the `signum` cases for double and float now 
have to match Spark. They fail without the fix.
   - `signum.sql`: added signed zeros in a double and a float column, the 
string form of the result, and interval inputs with the expected fallback 
reason.
   - Unit tests for the kernel covering both zeros by bit pattern, NaN, the 
infinities, null, and scalar input.
   


-- 
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]

Reply via email to