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

   ## Which issue does this PR close?
   
   Closes #25942.
   
   ## Rationale for this change
   
   With ANSI mode disabled, Spark `negative()` on decimal columns can fail with 
a schema type mismatch or return incorrectly scaled values when cast to 
`DOUBLE`.
   
   ## What changes are included in this PR?
   
   Preserve the input decimal data type after both checked and wrapping array 
negation, retaining the original precision and scale.
   
   ## What is the testing strategy for this PR?
   
   Added SQL regression tests in `spark/math/negative.slt` using table columns 
to exercise the array path. They cover Decimal32, Decimal64, Decimal128, and 
Decimal256 with non-default precision, positive and negative values, zero, 
NULL, positive/zero/negative scales, and casts to `DOUBLE`, with ANSI mode both 
disabled and enabled.
   
   The new regression tests fail before the implementation change and pass 
after it.
   
   Validation:
   
   - `cargo fmt --all`
   - `cargo clippy --all-targets --all-features -- -D warnings`
   - `cargo test --profile ci --test sqllogictests -- spark/math/negative`
   - `uv run ./dev/rust_lint.sh`
   - Extended workspace tests:
   
     ```shell
     RUST_BACKTRACE=1 cargo test --profile ci \
         --exclude datafusion-examples --exclude datafusion-benchmarks 
--exclude datafusion-cli \
         --workspace --lib --tests --bins \
         --features 
avro,json,backtrace,extended_tests,recursive_protection,parquet_encryption
     ```
   
   No existing local benchmark exercises Spark `negative()`.
   
   ## Are there any user-facing changes?
   
   Spark `negative()` now returns correctly scaled decimal column values and 
preserves their declared type when ANSI mode is disabled. No public API changes.
   


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