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

   ## Which issue does this PR close?
   
   - Closes #22485.
   
   ## Rationale for this change
   
   Displaying `Decimal` values (e.g., in `EXPLAIN` output or in auto-generated 
column names) included Rust's `Some` notation. For example:
   
   ```
   > set datafusion.sql_parser.parse_float_as_decimal = true; explain select 
0.1;
   ```
   
   Eliding the rest of the `EXPLAIN` output, the projection is rendered as as 
`Decimal128(Some(1),1,1): Some(1),1,1`.
   
   This is not very readable:
   1. Users may not understand the Rust `Option` syntax
   2. When the value is `None`, we should print `NULL` anyway, so showing the 
`Option` is not useful anyway
   3. The user needs to do math to convert the value (`1`) into the actual 
value (`0.1`)
   
   This PR changes how `Decimal` values are displayed. For example, the query 
above would show the projection as: `Decimal128(0.1,1,1): 0.1`.
   
   ## What changes are included in this PR?
   
   * Update `fmt::Display` and `fmt::Debug` for `ScalarValue` to use the new 
format for `Decimal` values
   * Rename `fmt_binary` to `fmt_binary_debug` for consistency (this format is 
used by `Debug`, not `Display`)
   * Add unit tests for new formatting behavior
   * Update SLTs / goldens for new output format
   
   ## Are these changes tested?
   
   Yes.
   
   ## Are there any user-facing changes?
   
   Yes. This change may break users that have `EXPLAIN` output or 
auto-generated column names in golden files, and other places where the `Debug` 
/ `Display` of a `ScalarValue` is being compared against.


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