Repository navigation
[975] Convert Paimon partition values to typed values during sync - #1058
Open
shubhammittal92 wants to merge 1 commit into
Open
shubhammittal92 wants to merge 1 commit into
shubhammittal92 wants to merge 1 commit into
Conversation
PaimonPartitionExtractor.toPartitionValues wrapped the raw partition-path strings from InternalRowPartitionComputer.generatePartValues directly in Range.scalar, so every partition value reached the Delta and Iceberg targets as a String. For a non-STRING partition column (DATE, INT, BIGINT, ...) the targets expect the typed form the other sources produce (an epoch-day Integer for DATE, an Integer for INT, a Long for BIGINT), so the sync failed with: java.lang.ClassCastException: Cannot cast java.lang.String to java.lang.Integer A null partition value also reached the targets as the string "__DEFAULT_PARTITION__" instead of null. Convert each partition value to its typed form based on the partition field's InternalType, reusing DeltaValueConverter.convertFromDeltaPartitionValue (the same converter DeltaKernelPartitionExtractor already reuses outside the delta package), and map the configured default-partition name back to null. Tests: added unit tests in TestPaimonPartitionExtractor for DATE/INT/LONG/STRING typing and for the null / default-partition sentinel. The existing real STRING partitioned-table test continues to pass. Signed-off-by: Shubham Mittal <shubmittal.92@gmail.com>
This branch has not been deployed
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.
Fixes #975
What is the purpose of the pull request
When Paimon is the source, a table partitioned by a non-STRING column failed to sync to Delta and Iceberg.
PaimonPartitionExtractor.toPartitionValueswrapped the raw partition-path strings fromInternalRowPartitionComputer.generatePartValuesdirectly inRange.scalar, so every partition value reached the targets as aString. The Delta and Iceberg targets expect the typed form the other sources produce (anIntegerepoch day forDATE, anIntegerforINT, aLongforBIGINT), so for aDATE/INT/BIGINTpartition the sync failed with:A null partition value also reached the targets as the string
__DEFAULT_PARTITION__instead ofnull.Brief change log
InternalType, reusingDeltaValueConverter.convertFromDeltaPartitionValue— the same converterDeltaKernelPartitionExtractoralready reuses outside thedeltapackage, which keeps Paimon's partition values consistent with the other sources.table.coreOptions().partitionDefaultName()) back tonull.DATE/INT/LONG/STRINGtyping and for the null / default-partition sentinel.Verify this pull request
This change added tests and can be verified as follows:
testConvertPartitionValueProducesTypedValues(assertsDATE→epoch-dayInteger,INT→Integer,LONG→Long,STRING→String) andtestConvertPartitionValueMapsNullAndDefaultPartitionToNull.testToPartitionValuesWithPartitionedTable, STRING partition) continues to pass, confirming no regression on the common case.spotless:checkis clean.Originally reported in #869.