linliu-code commented on code in PR #19713:
URL: https://github.com/apache/hudi/pull/19713#discussion_r3840233581
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java:
##########
@@ -450,7 +494,8 @@ private static <R> Option<HoodieRecord<R>>
mergeIncomingWithExistingRecord(
// the record was deleted
return Option.empty();
Review Comment:
Done, took the inline-comment form: `existingRecordContext, mergeResult, /*
partitionResolvableFromRecord */ true)`. Kept it as a literal rather than a
local because that branch merges against the full write schema, so the
partition is always resolvable from the record; the comment now says which
parameter it is without implying the value is computed.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java:
##########
@@ -503,6 +548,21 @@ public static <R> HoodieData<HoodieRecord<R>>
mergeForPartitionUpdatesAndDeletio
HoodieSchema writerSchemaWithMetaFields =
HoodieSchemaUtils.addMetadataFields(writerSchema,
updatedConfig.allowOperationMetadataField());
HoodieSchemaCache.intern(writerSchema);
HoodieSchemaCache.intern(writerSchemaWithMetaFields);
+ // Under partial updates the merge produces a record carrying only the
assigned columns, and the log
+ // block is written with that schema: HoodieAppendHandle and
BaseWriteHelper both take it from this
+ // same config. Meta fields therefore have to be prepended onto the
partial schema, not the full
+ // write schema, or they occupy the wrong positions. Resolves to the write
schema otherwise.
+ HoodieSchema mergedRecordSchema = updatedConfig.shouldWritePartialUpdates()
+ ?
HoodieSchemaCache.intern(HoodieSchema.parse(updatedConfig.getPartialUpdateSchema()))
+ : writerSchema;
Review Comment:
Done, aligned the locals to the parameter names: `mergedSchema` /
`mergedSchemaWithMetaFields`. That direction rather than renaming the
parameters, since the parameter names are the ones already in use at the other
call site.
--
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]