Repository navigation
[fix](iceberg) Fix wrong processing for NaN - #64315
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
/review |
|
/review |
|
run buildall |
There was a problem hiding this comment.
Review result: no blocking issues found in the focused Iceberg NaN change set.
Critical checkpoint conclusions:
- Goal/test proof: The PR fixes special floating-point partition values by serializing BE dynamic Iceberg partition values as
NaN,Infinity, and-Infinity, and by allowing FE commit-side parsing of lowercase/short spellings. BE and FE unit coverage was added for these cases. - Scope/focus: The actual GitHub PR diff is small and focused on Iceberg floating-point partition value handling.
- Concurrency/lifecycle: No new concurrency or lifecycle management is introduced in the reviewed files.
- Config/compatibility: No new config, protocol field, storage format, or incompatible serialized layout change was found. The parser is more permissive for existing lowercase
nan/infvalues. - Parallel paths: BE writer output and FE Iceberg partition parsing paths were both updated. Existing FE serialization from Iceberg
PartitionDataalready uses JavaFloat.toString/Double.toString, which produces compatible spellings. - Error handling: Existing parse failures still surface as
IllegalArgumentExceptionwith partition value/type context. - Test coverage: Added focused BE and FE unit tests for NaN and infinities. I did not run the full build/test suite in this review.
- Observability/performance: No extra observability appears necessary; the change is constant-time and not on a new hot allocation path beyond existing string conversion.
User focus: No additional user-provided review focus was present.
There was a problem hiding this comment.
Automated review completed. I did not find blocking issues in the actual GitHub PR diff.
Critical checkpoint conclusions:
- Goal/test: The PR addresses the stated Iceberg FLOAT/DOUBLE NaN/Infinity partition serialization issue. BE now emits Java-compatible
NaN,Infinity, and-Infinity, and FE parsing accepts legacy lowercasenan/infvariants. Unit tests cover both sides. - Scope: The actual GitHub diff is focused on the Iceberg partition value path and related tests.
- Concurrency/lifecycle: Not applicable; no concurrent state or lifecycle ownership changes in the actual diff.
- Configuration/compatibility: No new config or storage format changes. FE legacy lowercase parsing is backward-compatible for previously emitted partition strings.
- FE-BE consistency: BE emitted strings now match Java parser expectations; FE parser also handles old lowercase special values.
- Data correctness: No issue found in the touched identity/static partition conversion paths.
- Tests: Added BE and FE unit coverage for special floating-point values. I did not run tests in this runner.
- Observability/performance: No additional observability needed; the added special-value checks are constant-time and not a performance concern.
- User focus: No additional user-provided review focus was supplied.
TPC-H: Total hot run time: 28986 ms |
TPC-DS: Total hot run time: 168865 ms |
|
run buildall |
TPC-H: Total hot run time: 28898 ms |
TPC-DS: Total hot run time: 168998 ms |
FE UT Coverage ReportIncrement line coverage |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
FE Regression Coverage ReportIncrement line coverage |
|
/review |
There was a problem hiding this comment.
Review summary:
No blocking issues found. The PR addresses the stated goal: BE now serializes identity FLOAT/DOUBLE Iceberg partition values as Java/Iceberg-compatible NaN, Infinity, and -Infinity, and FE commit parsing accepts legacy lowercase spellings before building PartitionData.
Critical checkpoint conclusions:
- Goal/tests: Covered by targeted BE and FE unit tests for NaN and infinities. Small residual test gap: the FE implementation accepts positive legacy
inf/+inf, but the new test does not assert those exact spellings. - Scope: The change is small and focused on Iceberg partition value serialization/parsing.
- Concurrency/lifecycle/config: No new shared state, locks, special lifecycle, static initialization dependency, or config item is introduced.
- Compatibility: Backward compatible for old BE lowercase partition strings; new BE output matches Java parser spelling and existing FE
serializePartitionValueoutput. - Parallel paths: Data-file commit conversion, delete-file partition conversion, conflict filter construction, and static overwrite filtering all route through
parsePartitionValueFromString; no separate BE-sent partition-value parsing path was found. - Error handling/data correctness: Existing exception/non-OK propagation is preserved; null partition sentinel handling is unchanged.
- Performance/observability: Added checks are constant-time and do not need new observability.
- Test artifacts: Only unit tests are changed; no regression
.outfiles are involved. I did not run the test suites during this review.
User focus points: .opencode-review.0uGIzG/review_focus.txt contained no additional review focus.
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
This change fixes Iceberg writes when FLOAT or DOUBLE partition values contain NaN or infinity. Previously, the BE Iceberg writer serialized floating-point partition values with std::to_string(), which produced lowercase special values such as "nan", "inf", and "-inf". These strings are not accepted by Java's Float.parseFloat() / Double.parseDouble() in the FE partition commit path, causing writes with NaN partition values to fail. The fix canonicalizes BE floating-point partition serialization to Java/Iceberg-compatible values: "NaN", "Infinity", and "-Infinity". It also makes FE partition value parsing tolerate legacy lowercase forms such as "nan" and "-inf". Unit tests were added for BE partition value serialization and FE parsing of special floating-point partition values.
This change fixes Iceberg writes when FLOAT or DOUBLE partition values contain NaN or infinity. Previously, the BE Iceberg writer serialized floating-point partition values with std::to_string(), which produced lowercase special values such as "nan", "inf", and "-inf". These strings are not accepted by Java's Float.parseFloat() / Double.parseDouble() in the FE partition commit path, causing writes with NaN partition values to fail. The fix canonicalizes BE floating-point partition serialization to Java/Iceberg-compatible values: "NaN", "Infinity", and "-Infinity". It also makes FE partition value parsing tolerate legacy lowercase forms such as "nan" and "-inf". Unit tests were added for BE partition value serialization and FE parsing of special floating-point partition values.
This change fixes Iceberg writes when FLOAT or DOUBLE partition values contain NaN or infinity. Previously, the BE Iceberg writer serialized floating-point partition values with std::to_string(), which produced lowercase special values such as "nan", "inf", and "-inf". These strings are not accepted by Java's Float.parseFloat() / Double.parseDouble() in the FE partition commit path, causing writes with NaN partition values to fail. The fix canonicalizes BE floating-point partition serialization to Java/Iceberg-compatible values: "NaN", "Infinity", and "-Infinity". It also makes FE partition value parsing tolerate legacy lowercase forms such as "nan" and "-inf". Unit tests were added for BE partition value serialization and FE parsing of special floating-point partition values.
## Summary Backport the requested Apache Doris PRs to `branch-4.1` in their master merge order: 1. #63648 2. #64033 3. #64263 4. #64315 5. #63825 6. #65332 7. #65354 8. #65094 9. #65401 10. #65502 11. #65135 12. #65742 13. #65709 14. #65548 15. #65676 16. #65770 17. #65759 18. #65782 19. #65784 20. #65674 21. #65921 22. #65934 23. #65925 24. #65931 #64263, #65354, #65094, #65502, and #65770 are already effectively present on current `branch-4.1`, so this branch does not duplicate those commits. The remaining requested changes are represented by ordered backport commits followed by branch-4.1 compatibility fixes. ## Compatibility notes - Rebased onto the latest `upstream/branch-4.1` and retained both sides of the Iceberg scan conflict resolution. - Keep `be/src/format_v2` and `be/test/format_v2` exactly aligned with current `upstream/master`, as requested. - Apply branch-4.1 compatibility adaptations outside the format_v2 paths. - Preserve the selected PR behavior while avoiding dependencies on unrelated master-only changes. - #65921 supplies the Parquet benchmark scenario header required by `parquet_benchmark_scenarios_test.cpp`, fixing the BE UT compile failure. - Adapt branch-4.1 `VRuntimeFilterWrapper` at the master TableReader boundary so FileScannerV2 residual predicates keep globally rewritten slot indexes. - Keep non-transactional JDBC V2 connections usable by avoiding the unsupported auto-commit transition before Hikari invalidates the proxy. ## FE UT fix - Widen the auto-profile test timing margins to prevent CI scheduling delays from selecting the wrong threshold branch. - Keep the table-filter correctness assertions and use broader performance guardrails suitable for shared FE UT workers. ## Verification - Full local FE+BE build: `Successfully build Doris`. - ASAN BE UT build completed successfully; `test/doris_be_test` linked with exit code 0. - Related BE tests: 382/382 passed across 32 suites, including FileScannerV2, runtime filters, Parquet, Iceberg readers, and format_v2 coverage. - JDBC scanner UT: 3/3 passed; Maven reactor `BUILD SUCCESS`; Checkstyle reports 0 violations. - ClickHouse JDBC V2 regression: 1 suite, 0 failed suites, 0 fatal scripts. - Iceberg branch/tag regression (`iceberg_branch_complex_queries`): 1 suite, 0 failed suites, 0 fatal scripts. - Repository clang-format 16 check: passed for 4,191 files. - `git diff --check`: passed. - `be/src/format_v2` and `be/test/format_v2` have zero diff from current `upstream/master`. --------- Signed-off-by: Gabriel <liwenqiang@selectdb.com> Co-authored-by: daidai <changyuwei@selectdb.com>
### 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?
This change fixes Iceberg writes when FLOAT or DOUBLE partition values contain NaN or infinity.
Previously, the BE Iceberg writer serialized floating-point partition values with std::to_string(), which produced lowercase special values such as "nan", "inf", and "-inf". These strings are not accepted by Java's
Float.parseFloat() / Double.parseDouble() in the FE partition commit path, causing writes with NaN partition values to fail.
The fix canonicalizes BE floating-point partition serialization to Java/Iceberg-compatible values: "NaN", "Infinity", and "-Infinity". It also makes FE partition value parsing tolerate legacy lowercase forms such as "nan" and
"-inf".
Unit tests were added for BE partition value serialization and FE parsing of special floating-point partition values.
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)