CalvinKirs opened a new pull request, #68601:
URL: https://github.com/apache/doris/pull/68601
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: ColumnStatistic#toString() formats minValue/maxValue with
`%f`, which prints every integer digit of the double verbatim. For columns
where the value is encoded into a double whose magnitude exceeds a double's
real precision (e.g. the byte-packed encoding StringLikeLiteral#getDouble()
uses for VARCHAR/STRING/CHAR min/max), the trailing digits beyond that
precision are implementation-defined. JDK 19 changed the
Double/Float-to-decimal algorithm (shared between `Double.toString()` and
`Formatter`'s `%f`/`%g`), so the same double bit pattern now formats with
different trailing digits than it did on JDK 17, even though the value itself
is unchanged (`Double.doubleToLongBits` is identical). This breaks regression
tests that assert on the exact explain-plan text, e.g.
`statistics/test_utf_encoding.groovy` expected
`min=64379158486625512.000000(...)` but got `min=64379158486625510.000000(...)`.
Fix: format min/max with `%.6g` instead of `%f`. Six significant digits is
well inside a double's guaranteed ~15-17 digit precision, so the same double
now formats identically on every JDK. Verified: reproduced the JDK 17 vs JDK 21
`%f` divergence with a standalone Java snippet, confirmed `%.6g` gives
byte-identical output on both, and updated the two regression suites whose
assertions embed the old `%f` text (`statistics/test_utf_encoding.groovy`,
`query_p0/stats/partition_key_minmax.groovy`).
### Release note
None
### Check List (For Author)
- Test: Regression test
- `query_p0/stats/partition_key_minmax` passes locally via
`run-regression-test.sh`.
- `statistics/test_utf_encoding`'s explain-plan assertion was verified
by hand against a live FE (matches the new `%.6g` text); the suite itself was
not run end to end.
- Behavior changed: Yes (the min/max text in `explain ... memo plan` output
and any log line built from `ColumnStatistic#toString()` now prints 6
significant digits instead of every integer digit)
- Does this need documentation: 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]