Conversation
### What problem does this PR solve? Issue Number: N/A Problem Summary: FORMAT_ROUND skipped rounding for Decimal inputs when decimal_places was zero because the rounding branch required a positive decimal-place count. Round whenever the input scale exceeds the requested decimal places and add regression coverage for zero decimal places. ### Release note Fix FORMAT_ROUND for Decimal inputs with zero decimal places. ### Check List (For Author) - Test: Regression test - Behavior changed: Yes; Decimal values are rounded correctly when decimal_places is zero. - Does this need documentation: No
Contributor
Author
|
/review |
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
There was a problem hiding this comment.
Static review opinion: LGTM; no PR-introduced blocking issue found.
Critical checkpoint conclusions:
- Goal and correctness: the changed predicate now runs the existing Decimal fractional reduction when zero places are requested. For DecimalV2/32/64/128, the zero-place quotient is one digit, half-away-from-zero behavior is preserved, sign/carry handling is correct, and the carry plus output buffer remain in range.
- Scope and parallel paths: this is a focused one-condition fix. Double and integer behavior is unchanged, and all implemented Decimal widths share the corrected helper. The registered Decimal256 executor gap was independently verified as real but pre-existing at the base SHA for every place count; Decimal256 never reaches the changed helper, so it is not a finding against this PR.
- Tests: the changed expected results are correct and cover positive/negative Decimal32 carry/no-carry plus a Decimal128 column path. Exact-half, sub-unit, DecimalV2/64, all-9s, and row-varying-place cases would strengthen coverage, but static tracing found no defect in those paths. Per the review contract, no build or test was run here, so the regression result is not independently executed.
- Concurrency, lifecycle, compatibility, and operations: no shared state, locking, ownership, configuration, FE-BE protocol, persistence, storage format, transaction, observability, or ABI behavior changes. Existing null and Status propagation remain intact.
- Performance: the added constant-time exponent lookup and division occur only where required for correct zero-place Decimal rounding; no material allocation or asymptotic regression was found.
- User focus: no additional focus was supplied.
Review completion: the main risk scan and two normal/risk convergence rounds completed; both Round 2 reviewers returned NO_NEW_VALUABLE_FINDINGS, every candidate was adjudicated, the final duplicate fence is empty, and the live PR head was verified at 1c2a288 before submission.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
format_roundskipped rounding for Decimal values whendecimal_placeswas zero because the rounding branch required a positive decimal-place count. Values such as1.9and-1.9therefore produced truncated results instead of2and-2. The condition now performs rounding whenever the input scale exceeds the requested decimal places, including zero, and regression coverage verifies positive, negative, and table-column Decimal values.Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)