Repository navigation
[fix](be) Use shortest round-trip floating-point strings - #65609
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
Possible file(s) that should be tracked in LFS detected: 🚨The following file(s) exceeds the file size limit:
Consider using |
Possible file(s) that should be tracked in LFS detected: 🚨The following file(s) exceeds the file size limit:
Consider using |
|
run buildall |
### What problem does this PR solve? Issue Number: None Related PR: apache#65609 Problem Summary: The legacy analyzer FloatLiteral unit test still expected the previous precision-limited float and double formatting. Update all stale positive, negative, boundary, and scientific-notation expectations to the shortest round-trip format already used by FE and BE. ### Release note None ### Check List (For Author) - Test: Unit Test - ./run-fe-ut.sh --run org.apache.doris.analysis.FloatLiteralTest,org.apache.doris.analysis.ExprToStringValueVisitorTest,org.apache.doris.nereids.trees.expressions.literal.DoubleLiteralTest,org.apache.doris.nereids.trees.expressions.literal.FloatLiteralTest - Behavior changed: No - Does this need documentation: No
Possible file(s) that should be tracked in LFS detected: 🚨The following file(s) exceeds the file size limit:
Consider using |
|
test |
|
run buildall |
TPC-H: Total hot run time: 29594 ms |
TPC-DS: Total hot run time: 177975 ms |
ClickBench: Total hot run time: 24.82 s |
FE UT Coverage ReportIncrement line coverage |
FE Regression Coverage ReportIncrement line coverage |
|
Do not modify it anymore |
Possible file(s) that should be tracked in LFS detected: 🚨The following file(s) exceeds the file size limit:
Consider using |
Formatting float and double values with max_digits10 preserves round-trip precision but emits redundant digits such as 1.1000000000000001. Use fmt Dragonbox shortest-round-trip formatting in BE and bit-exact matching formatting in FE, and synchronize affected tests and expected results.
01f656d to
4823985
Compare
|
run buildall |
Possible file(s) that should be tracked in LFS detected: 🚨The following file(s) exceeds the file size limit:
Consider using |
FE UT Coverage ReportIncrement line coverage |
Possible file(s) that should be tracked in LFS detected: 🚨The following file(s) exceeds the file size limit:
Consider using |
# Conflicts: # .gitleaks.toml
Possible file(s) that should be tracked in LFS detected: 🚨The following file(s) exceeds the file size limit:
Consider using |
|
skip buildall |
Floating number to string is now handled correctly by CastToString::from_number in PR apache#65609, special handing in DataTypeNumberSerDe<T>::to_olap_string is not necessary now.
### What problem does this PR solve? Issue Number: close #xxx Related PR: #65302 Problem Summary: Floating number to string is now handled correctly by CastToString::from_number in PR #65609, special handing in DataTypeNumberSerDe<T>::to_olap_string is not necessary now. ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
…6425) ### What problem does this PR solve? Pick #65609 and #66375 Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into --> --------- Co-authored-by: lidongyang <lidongyang@selectdb.com>
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Formatting float and double values with max_digits10 preserves
round-trip precision but emits redundant digits such as
1.1000000000000001. Use fmt Dragonbox shortest-round-trip formatting in
BE and bit-exact matching formatting in FE, and synchronize affected
tests and expected results.
### Release note
Float and double values now use shortest round-trip string formatting
consistently in FE and BE.
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---------
Co-authored-by: lidongyang <lidongyang@selectdb.com>
### What problem does this PR solve? Issue Number: close #xxx Related PR: apache#65302 Problem Summary: Floating number to string is now handled correctly by CastToString::from_number in PR apache#65609, special handing in DataTypeNumberSerDe<T>::to_olap_string is not necessary now. ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
related PR: #65609 ### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
related PR: #65609 ### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
### Background The Iceberg writer serializes identity partition values for writer grouping, file paths, and commit metadata. FE parses those values using the declared Iceberg partition type. ### What problem does this PR solve? Issue Number: None Related PR: apache#64315 (special-value handling), apache#65609 (shortest round-trip formatting) PR Type: Bugfix Problem Summary: Finite FLOAT and DOUBLE identity partition values currently pass through fixed six-decimal formatting. Distinct values such as 1.0000001 and 1.0000002 then become the same partition string, so writer grouping and committed metadata can omit the original value. Serialize finite values with shortest round-trip formatting and retain the special-value representations. ### Details - **Frequency:** Every dynamic finite identity partition value that cannot round-trip through fixed six-decimal formatting. - **Root cause:** The shared floating-point partition serializer uses std::to_string for finite values. - **Why existing tests missed it:** Partition transform tests exercised NaN and infinities. Existing external Iceberg tests did not verify exact metadata and writer grouping for adjacent finite partitions. - **Fix:** Format the original FLOAT or DOUBLE with fmt. Test identity transform commit and path strings with adjacent values, signed zeros, subnormals, and finite extrema. - **Other paths and branches:** Dynamic identities share the changed serializer. Precomputed static inputs use their existing path. The precision loss exists on 3.1, 4.0, 4.1, and 4.2. The checked 4.2 production file matches the master baseline. - **Behavior change:** New writes preserve finite FLOAT and DOUBLE partition values. This change does not repair previously rounded metadata. ### Testing - Repository clang-format and check-format passed with Homebrew clang-format 16.0.6. BE header hygiene and Git whitespace checks passed. - A compile-free IEEE-754 reference calculation confirmed that the two distinct examples collapse under fixed six-decimal formatting. - Added two PartitionTransformersTest cases. Local BE unit and external SQL tests were not run because this workline excludes compilation and cluster startup. The compilation database required for clang-tidy is absent. ### Release note New Iceberg writes preserve finite floating-point partition values, preventing distinct partitions from sharing rounded commit metadata. ### Check List (For Author) - Behavior changed: Yes (see Details). - Does this need documentation: No. - Pre-submission status: Partially verified: BE unit tests, external Iceberg SQL, and clang-tidy remain pending. ### AI Disclosure - Tool: Codex (GPT-6). - Generated: Local verification notes and this description. - Human review: Pending.
### Background The Iceberg writer serializes partition values as strings for writer grouping, partition paths, and FE commit metadata. The FE parses these strings using each partition field's declared type before building Iceberg PartitionData. ### What problem does this PR solve? Issue Number: None Related PR: #64315 (special-value handling), #65609 (round-trip floating-point formatting) PR Type: Bugfix Problem Summary: Finite FLOAT and DOUBLE identity partition values were serialized with std::to_string, which retains only six digits after the decimal point. For example, DOUBLE values 1.0000001 and 1.0000002 both became 1.000000, producing incorrect partition metadata and potentially merging distinct partitions into one writer. Subsequent partition filtering can silently omit matching rows. Use the existing fmt shortest-round-trip formatting for finite partition values while preserving the current NaN and infinity spellings. This fixes the shared serialization used by writer keys, paths, and commit values. Previously written incorrect metadata is not repaired by this change. ### Details - **Frequency:** Triggered by dynamic FLOAT/DOUBLE identity partition values that cannot round-trip through fixed six-decimal formatting; no concurrency is required. - **Root cause:** floating_point_partition_value_to_string used std::to_string for finite values, losing precision before writer grouping and FE partition parsing. - **Why existing tests missed it:** Existing partition serialization tests cover NaN and infinities, without finite precision or signed-zero bit comparisons. - **Fix:** Use fmt::format with the original FLOAT/DOUBLE type. Add actual transform unit tests for adjacent values, small values, finite extrema, subnormals, signed zeros, commit/human-string consistency, and distinct partition strings. - **Other paths and branches:** Dynamic writer keys, partition paths, and commit values share this helper. No FE parser or Thrift changes are needed. Full static partition fields use a separate precomputed-value path. Apache branch-4.2 at 0a24ed8 has the identical affected production file and should receive this fix and tests; the complete patch applies cleanly, and no additional prerequisite picks are needed. - **Behavior change:** New writes preserve the original finite floating-point partition values. NaN/infinity handling is unchanged. Existing files with incorrect partition metadata still require separate recovery. ### Testing - Passed clang-format v16, build-support/check-format.sh, build-support/check-build-hygiene.sh, and git diff --check. - Independently compiled helpers extracted from the baseline and modified production source, then parsed their output using Java Float.parseFloat/Double.parseDouble. The original implementation lost finite-value precision in 10,006 FLOAT and 10,208 DOUBLE samples; the modified implementation had zero round-trip failures across 40,034 samples, including special values and signed zeros. - The typed fast_float parser used by the new unit tests also preserved all 39,923 finite samples. These isolated experiments do not execute the full Doris transform, writer, or commit path. - Added PartitionTransformersTest.test_float_partition_value_round_trip and test_double_partition_value_round_trip. Full BE UT was not run: this worktree has no existing BE build, approximately 4.5 GB of free disk space remains, and run-be-ut.sh builds the complete BE test binary even with a GTest filter. - No end-to-end Iceberg SQL regression or clang-tidy run: an isolated built cluster and BE compilation database are not available. No regression golden files were handwritten. - Verified that the production fix and unit-test patch apply cleanly to the current branch-4.2 files. ### Notes for Reviewers This remains a draft until the full BE tests and external Iceberg SQL checks are completed. Suggested unit-test command: ./run-be-ut.sh --run --filter='PartitionTransformersTest.*' -j 1. The SQL check should write DOUBLE partitions 1.0000001 and 1.0000002, verify distinct accurate typed partitions in the files metadata, and expect equality/range counts of 1, 1, and 2. Recommend picking this PR to branch-4.2 after merge. ### Release note Fix precision loss when writing finite FLOAT/DOUBLE Iceberg identity partition values, preventing incorrect partition metadata and missing rows during partition filtering for newly written data. ### Check List (For Author) - Test: - [ ] Regression test - [ ] Unit Test (added; full BE test binary not built locally) - [x] Manual test (isolated serialization/parser experiments and formatting/hygiene checks described above) - Behavior changed: Yes (see Details) - Does this need documentation: No - Pre-submission status: Partially verified: full BE UT, end-to-end Iceberg SQL regression, and clang-tidy remain pending; keep as Draft. ### AI Disclosure - Tool: Codex - Generated: Code, unit tests, validation probes, and this description. - Human review: Pending.
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Formatting float and double values with max_digits10 preserves round-trip precision but emits redundant digits such as 1.1000000000000001. Use fmt Dragonbox shortest-round-trip formatting in BE and bit-exact matching formatting in FE, and synchronize affected tests and expected results.
Release note
Float and double values now use shortest round-trip string formatting consistently in FE and BE.
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)