You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "haruki-830 (via GitHub)" <gi...@apache.org> on 2026/05/29 06:49:55 UTC
[PR] [FLINK-39758] Fix DECIMAL OOB in SchemaMergingUtils [flink-cdc]
haruki-830 opened a new pull request, #4419:
URL: https://github.com/apache/flink-cdc/pull/4419
**Summary**
This commit fixes the DECIMAL precision overflow (Out-Of-Bounds) issue in SchemaMergingUtils and SchemaUtils, which previously caused pipeline failures when merging DECIMAL types from multiple tables with significantly different precisions and scales.
**Key Changes**
1. New createDecimalBounded Utility Method
- Introduced createDecimalBounded method in SchemaMergingUtils to handle DECIMAL precision overflow gracefully
- When computed precision exceeds DecimalType.MAX_PRECISION (38), the method truncates scale digits instead of throwing an exception
- Truncation formula: lossDigits = precision - MAX_PRECISION, then resultPrecision = precision - lossDigits, resultScale = scale - lossDigits
- Follows the same approach as Flink SQL for handling DECIMAL overflow
2. SchemaMergingUtils Fix
- Replaced Preconditions.checkArgument with createDecimalBounded call in mergeDecimalTypes()
- Removed the hard failure that threw IllegalArgumentException when merged precision exceeded 38
- SchemaUtils Fix
- Applied the same createDecimalBounded fix in inferWiderType() for DECIMAL-to-DECIMAL merging
- Applied the same fix in mergeExactNumericsIntoDecimal() for DECIMAL-to-integer merging
3. Comprehensive Testing
- Updated SchemaUtilsTest to verify that overflow cases now return bounded DECIMAL types instead of throwing exceptions
- Added testMergingDecimalWithOutOfBoundPrecisions with 6 parameterized test cases covering various overflow scenarios
- Refactored FlinkPipelineComposerITCase to support generic merging test infrastructure via runGenericMergingTest
**Before fix:** Merging DECIMAL(5, 5) and DECIMAL(38, 0) throws IllegalArgumentException (requires precision 43, max 38)
**After fix:** Merging DECIMAL(5, 5) and DECIMAL(38, 0) returns DECIMAL(38, 0)
**JIRA Reference**
[https://issues.apache.org/jira/browse/FLINK-39758](url)
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39758] Fix DECIMAL OOB in SchemaMergingUtils [flink-cdc]
Posted by "lvyanquan (via GitHub)" <gi...@apache.org>.
lvyanquan commented on PR #4419:
URL: https://github.com/apache/flink-cdc/pull/4419#issuecomment-4608323417
The failed case is unrelated to the changes in this PR.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39758] Fix DECIMAL OOB in SchemaMergingUtils [flink-cdc]
Posted by "lvyanquan (via GitHub)" <gi...@apache.org>.
lvyanquan commented on PR #4419:
URL: https://github.com/apache/flink-cdc/pull/4419#issuecomment-4586304211
There are compilation failures.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39758] Fix DECIMAL OOB in SchemaMergingUtils [flink-cdc]
Posted by "haruki-830 (via GitHub)" <gi...@apache.org>.
haruki-830 commented on PR #4419:
URL: https://github.com/apache/flink-cdc/pull/4419#issuecomment-4571992847
@lvyanquan could you please help review this PR
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-39758] Fix DECIMAL OOB in SchemaMergingUtils [flink-cdc]
Posted by "lvyanquan (via GitHub)" <gi...@apache.org>.
lvyanquan merged PR #4419:
URL: https://github.com/apache/flink-cdc/pull/4419
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org