raghav-reglobe opened a new pull request, #69219:
URL: https://github.com/apache/doris/pull/69219
### What problem does this PR solve?
Issue Number: close #69218
Related PR: none
Problem Summary:
`format_json_double` in `variant_string_parse.cpp` formatted a double with
`digits10 + 1` = 16 significant digits, one
short of what a binary64 can need, so `0.30000000000000004` rendered as
`0.3` and `1997.6000000000001` as `1997.6`: two
different doubles, and every reader that parsed a number out of
`CAST(variant AS STRING)` stored the neighbour. The
element path (`v['s']`) was already exact; the loss was in the document
writer. fmt's default `{}` (Dragonbox) is the
shortest representation that round-trips.
### Release note
Fix the JSON text of a VARIANT value rendering some doubles with 16
significant digits (not round-trip safe); the
document text now uses the shortest representation that parses back to the
same double.
### Check List (For Author)
- Test
- [x] Unit Test —
`DataTypeVariantV2SerdeOutputTest.DoublesRenderWithTheirShortestRoundTripForm`:
seven doubles
through both text surfaces and one document.
- Behavior changed:
- [x] Yes. The text form of a double inside a VARIANT document can now
carry 17 significant digits where the value
needs them (e.g. `0.30000000000000004` instead of `0.3`).
- Does this need documentation?
- [x] No.
--
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]