galaxytemple opened a new pull request, #26963:
URL: https://github.com/apache/datafusion/pull/26963

   ## Which issue does this PR close?
   - Closes #26333
   
   ## Rationale for this change
   In `datafusion-spark`, `atan2` with `-0.0` arguments returns different 
results from Apache Spark
   - datafusion-spark: `atan2(-0.0, -1.0)` returns `-pi`
   - Spark: returns `pi`. because it adds 0.0 turning `-0.0` to `0.0`
   
   @comphead linked the Spark source in #26333, so I checked the code and 
comments there. I don't know enough about IEEE 754 to fully understand their 
reason, but I believe matching Spark's behavior is what matters most.
   
   ## What changes are included in this PR?
   - Add `0.0` to both arguments in `spark_atan2` 
(`datafusion/spark/src/function/math/atan2.rs`).
   - Update expected value in `atan2.slt` for `atan2(-0.0, -1.0)` to 
`3.141592653589793`.
   - Add test cases in `atan2.slt` for `atan2(0.0, -0.0)` and `atan2(-0.0, 
-0.0)`.
   
   ## What is the testing strategy for this PR?
   - Verified query outputs on a local Spark 4.0.0
   - Tested with `cargo test -p datafusion-sqllogictest --test sqllogictests -- 
spark/math/atan2`
   
   ## Are there any user-facing changes?
   `atan2` in `datafusion-spark` now returns Spark-compatible values with 
arguments `-0.0`


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