Repository navigation
[core] Divide decimal product aggregate at the column scale on retract - #10220
Closed
LuciferYang wants to merge 1 commit into
Closed
LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
FieldProductAgg's retract divided decimals with a bare BigDecimal.divide, which throws ArithmeticException for any non-terminating or scale-exceeding quotient (e.g. 1 / 3) — a retract row into an aggregation table with a decimal product column killed the write or compaction job. Divide at the column scale with HALF_UP, the same rounding fromBigDecimal already applies, so the quotient rounds like every other decimal conversion instead of throwing. Assisted-by: GLM-5.3
LuciferYang
marked this pull request as draft
October 2, 2026 03:19
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.
Purpose
FieldProductAgg's retract path divided decimals with a bareBigDecimal.divide, which throwsArithmeticException("Non-terminating decimal expansion") for any quotient that does not terminate at the divisor scale, for example 1 / 3. A retract row into an aggregation table with a decimal product column then kills the write or compaction job.This divides at the column scale with
RoundingMode.HALF_UP, the same roundingfromBigDecimalalready applies on the line below, so the quotient rounds like every other decimal conversion instead of throwing, and retract stays consistent with how the forward agg path rounds its product.Tests
Added a case in
FieldAggregatorTestthat retracts 3 out of aDECIMAL(10,4)product column holding 1 and asserts the result is 0.3333, pinning that a non-terminating quotient now rounds at the column scale instead of throwing.API and Format
No.
Documentation
No.