[Fix] Swap canConvert argument order in CdcActionCommonUtils.schemaCompatible#8369
Open
0dunay0 wants to merge 1 commit into
Open
[Fix] Swap canConvert argument order in CdcActionCommonUtils.schemaCompatible#83690dunay0 wants to merge 1 commit into
0dunay0 wants to merge 1 commit into
Conversation
…mpatible schemaCompatible() was calling canConvert(sourceType, paimonType) but the method signature is canConvert(oldType, newType), where old is the existing Paimon type and new is the incoming source type. This caused valid type widenings such as INT -> BIGINT to be rejected at job startup with 'Paimon schema and source table schema are not compatible', even though the same widening is handled correctly at runtime by UpdatedDataFieldsProcessFunction. Fix: swap the arguments and update the log message to reflect the correct direction of the conversion check. Closes apache#5640
bf8991a to
a1d95fa
Compare
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.
What does this PR do?
Fixes a bug in
CdcActionCommonUtils.schemaCompatible()where valid type pairings were incorrectly rejected at CDC job startup.Root Cause
The original code called
canConvert(sourceType, paimonType)asking "can the source type be directly written into Paimon?" For a PaimonINTcolumn against aBIGINTsource, this returnsIGNORE(narrowing not permitted), blocking the job even though Paimon can safely evolveINT -> BIGINT.Fix
canConvert(old, new)returns one of:CONVERT— old can be widened to new (evolution needed but valid)IGNORE— old is already broader than new (source fits as-is, no evolution needed)EXCEPTION— incompatible type familiesA pairing is compatible if either direction produces
CONVERT:This covers both valid cases:
sourceToPaimon == CONVERT)paimonToSource == CONVERT)Cross-family pairs (e.g.
INTvsSTRING) returnEXCEPTIONin both directions so neither check producesCONVERTand they are correctly rejected.Cases
Verifying this change
Added
testSchemaCompatibleTypeWideningtoSchemaEvolutionTestcovering all four cases above.Closes #5640