Uh oh!
There was an error while loading. Please reload this page.
[HUDI-6804] Fix hive read schema evolution MOR table - #9573
Merged
Conversation
xiarixiaoyao
commented
Aug 30, 2023
Contributor
@Zouxxyy |
ContributorAuthor
The core change is hudi 0.11 may not have this patch #6989 and #6358 /** * Get final Read Schema for support evolution. * step1: find the fileSchema for current dataBlock. * step2: determine whether fileSchema is compatible with the final read internalSchema. * step3: merge fileSchema and read internalSchema to produce final read schema. * * @param dataBlock current processed block * @return final read schema. */privateOption<Pair<Function<HoodieRecord, HoodieRecord>, Schema>> composeEvolvedSchemaTransformer(
HoodieDataBlockdataBlock) {
if (internalSchema.isEmptySchema()) {
returnOption.empty();
}
longcurrentInstantTime = Long.parseLong(dataBlock.getLogBlockHeader().get(INSTANT_TIME));
InternalSchemafileSchema = InternalSchemaCache.searchSchemaAndCache(currentInstantTime,
hoodieTableMetaClient, false);
InternalSchemamergedInternalSchema = newInternalSchemaMerger(fileSchema, internalSchema,
true, false).mergeSchema();
SchemamergedAvroSchema = AvroInternalSchemaConverter.convert(mergedInternalSchema, readerSchema.getFullName());
returnOption.of(Pair.of((record) -> {
returnrecord.rewriteRecordWithNewSchema(
dataBlock.getSchema(),
this.hoodieTableMetaClient.getTableConfig().getProps(),
mergedAvroSchema,
Collections.emptyMap());
}, mergedAvroSchema));
} |
xiarixiaoyao
approved these changes
Aug 30, 2023
hudi-bot
commented
Aug 30, 2023
Collaborator
prashantwason pushed a commit
that referenced
this pull request
Sep 13, 2023
leosanqing pushed a commit
to leosanqing/hudi
that referenced
this pull request
Sep 13, 2023
TheR1sing3un pushed a commit
to TheR1sing3un/hudi
that referenced
this pull request
Feb 12, 2025
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 freeto 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.
Change Logs
Current hive read schema evolution MOR table will error, e.g. :
Impact
Fix above
Risk level (write none, low medium or high below)
low
Documentation Update
None
Contributor's checklist