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

   ## Which issue does this PR close?
   
   Backports apache/datafusion-spark#406 (the `%g` half of 
apache/datafusion-spark#39) to `branch-56` for 56.1. `datafusion-spark` now 
lives in apache/datafusion-spark, but 56.x still ships it from this repo.
   
   ## Rationale for this change
   
   `format_string('%g', 500.0D)` returns `500.` where Spark returns `500.000`. 
Java's `Formatter` keeps `%g`'s precision, six significant digits by default; 
we stripped the trailing zeros like C does.
   
   ## What changes are included in this PR?
   
   The same change as apache/datafusion-spark#406, applied to 
`datafusion/spark`: `%g` and `%G` no longer strip trailing zeros, for floats 
and decimals.
   
   ## What is the testing strategy for this PR?
   
   The `%g` expectations in `spark/string/format_string.slt` now keep their 
zeros, with new DOUBLE records for `500.000`, `1234.50`, `0.000100000` and 
`%.3g`. Verified on the backport branch:
   
   - `cargo fmt --all --check`
   - `cargo clippy -p datafusion-spark --all-targets --all-features -- -D 
warnings`
   - `cargo test -p datafusion-spark format_string`
   - `cargo test -p datafusion-sqllogictest --test sqllogictests -- 
spark/string/format_string`
   
   ## Are there any user-facing changes?
   
   Yes. `%g` and `%G` in Spark's `format_string` now return Spark's result.
   


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