sam-1112 opened a new pull request, #5393:
URL: https://github.com/apache/datafusion-comet/pull/5393

   ## Which issue does this PR close?
   
   Closes #5271.
   
   ## Rationale for this change
   
   Bare `-0.0` literals in SQL file tests are parsed by Spark as 
`decimal(1,1)`, which has no signed zero. Coercion to `double` or `float` 
yields `+0.0`, so rows that appear to test signed-zero behaviour are actually 
inserting `+0.0` on both sides — the coverage is vacuous. `CAST(-0.0 AS 
DOUBLE)` and `CAST(-0.0 AS FLOAT)` have the same problem because the cast 
source is still a decimal literal.
   
   ## What changes are included in this PR?
   
   - Replaced all bare `-0.0` and `CAST(-0.0 AS DOUBLE/FLOAT)` literals across 
**32 SQL test files** with `double('-0.0')` / `float('-0.0')`, which parse 
through the string path and preserve the sign bit.
   - Added `query ignore(...)` annotations for two known Spark/Comet 
divergences that became visible once the literals were fixed:
     - `array_min`: Spark returns `+0.0` when `+0.0` and `-0.0` are both 
present; Comet returns `-0.0`.
     - `sort_array` descending: Spark keeps `-0.0` before `+0.0`; Comet 
reverses them.
   - Added a **Signed zero** note in 
`docs/source/contributor-guide/sql-file-tests.md` so future contributors know 
to use `double('-0.0')` / `float('-0.0')` when writing float edge-case fixtures.
   
   ## How are these changes tested?
   All modified SQL test files were run against both Spark 4.1 (default 
profile, JDK 17) and Spark 3.4 (`-Pspark-3.4`) and passed.
   ```sh
   ./mvnw test -Dtest=none -Dscalastyle.skip=true \
     -Dsuites="org.apache.comet.CometSqlFileTestSuite \
       array_compact array_distinct array_except array_insert array_intersect \
       array_max array_min array_repeat array_union arrays_overlap arrays_zip \
       shuffle shuffle_with_seed sort_array sort_array_strict_fp \
       cast_array_to_string cast_complex_types_to_string cast_double_to_string \
       boolean arithmetic_ansi atan2 bin csc rint sec tan string_replace \
       approx_count_distinct avg collect_list collect_set percentile"
   # repeated with -Pspark-3.4
   ```
   Spotless format check also passed on both Spark 4.1 (default profile) and 
Spark 3.4 (`-Pspark-3.4`).


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