hudi-agent commented on code in PR #19713:
URL: https://github.com/apache/hudi/pull/19713#discussion_r3834706487


##########
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:
   🤖 nit: `mergedRecordSchema` and `mergedRecordSchemaWithMetaFields` are 
clear, but the corresponding method parameters are named `mergedSchema` / 
`mergedSchemaWithMetaFields` — could you align the local variable names with 
the parameter names (or vice versa) to avoid the asymmetry?
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



##########
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:
   🤖 nit: the bare `true` here is a bit opaque — could you add an inline 
comment like `/* partitionResolvableFromRecord */` or extract it as a local 
`boolean partitionResolvable = true` with a brief note that this branch never 
runs partial updates? Saves the next reader a trip to the method signature.
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



-- 
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]

Reply via email to