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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
