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

   ## Which issue does this PR close?
   
   - Closes #23717.
   
   ## Rationale for this change
   
   Spark and Java format negative numeric values with parentheses when the `(` 
flag is present. The decimal formatting path always emitted a minus sign 
because it ignored `negative_in_parentheses`, while the floating-point path 
already handled the flag. This made `format_string` inconsistent across numeric 
input types.
   
   ## What changes are included in this PR?
   
   - Add a closing suffix when a negative decimal uses parentheses formatting.
   - Include the suffix when calculating width, left alignment, and zero 
padding.
   - Add regression coverage for grouped negative decimals with and without an 
explicit width.
   
   ## Are these changes tested?
   
   Yes. The following checks pass locally:
   
   - `cargo fmt --all -- --check`
   - `cargo clippy --all-targets --all-features -- -D warnings`
   - `cargo test -p datafusion-spark --lib`
   - The full workspace test command from the contributor guide with 
`avro,json,backtrace,extended_tests,recursive_protection,parquet_encryption` 
enabled
   
   ## Are there any user-facing changes?
   
   Yes. Spark-compatible formatting of negative decimal values now honors the 
parentheses flag. There are no public API or breaking 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