beyond1920 commented on code in PR #10980:
URL: https://github.com/apache/hudi/pull/10980#discussion_r1555662848


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/HoodieMergeHandle.java:
##########
@@ -147,6 +149,13 @@ public HoodieMergeHandle(HoodieWriteConfig config, String 
instantTime, HoodieTab
     this.preserveMetadata = true;
     init(fileId, this.partitionPath, dataFileToBeMerged);
     validateAndSetAndKeyGenProps(keyGeneratorOpt, config.populateMetaFields());
+    // if the old schema equals to the new schema, avoid heavy rewriting
+    if (config.populateMetaFields() && useWriterSchemaForCompaction) {
+      LOG.info("Using update instead rewriting during compaction");
+      copyOldFunc = (key, record, schema, prop) -> 
this.updateMetadataToOldRecord(key, record, schema, prop);

Review Comment:
   Not exactly.
   The behavior is consistent with the old behavior.
   
   <img width="1419" alt="image" 
src="https://github.com/apache/hudi/assets/1525333/e254eab0-9c22-4658-a4a5-cc8faae9d2af";>
   
   
   <img width="1579" alt="image" 
src="https://github.com/apache/hudi/assets/1525333/438c9ee9-1189-4928-9c48-e102625c5967";>
   
   In the above pictures,  if `config.populateMetaFields() ` is true for 
compaction job, the `oldSchema` is equals to `writeSchemaWithMetaFields`.



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