danny0405 commented on code in PR #13229:
URL: https://github.com/apache/hudi/pull/13229#discussion_r2072273617


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieTableServiceClient.java:
##########
@@ -369,6 +393,31 @@ protected void completeCompaction(HoodieCommitMetadata 
metadata, HoodieTable tab
     LOG.info("Compacted successfully on commit {}", compactionCommitTime);
   }
 
+  public void commitLogCompaction(String compactionInstantTime, 
HoodieWriteMetadata<O> writeMetadata, Option<HoodieTable> tableOpt) {
+    // dereferencing the write dag for log compaction for the first time.
+    List<HoodieWriteStat> writeStats = 
triggerWritesAndFetchWriteStats(writeMetadata);
+    HoodieCommitMetadata commitMetadata = new HoodieCommitMetadata(true);
+    for (HoodieWriteStat stat : writeStats) {
+      commitMetadata.addWriteStat(stat.getPartitionPath(), stat);
+    }
+    commitMetadata.addMetadata(HoodieCommitMetadata.SCHEMA_KEY, 
config.getSchema());
+    HoodieTable table = tableOpt.orElseGet(() -> createTable(config, 
context.getStorageConf()));
+    Pair<Option<String>, Option<String>> schemaPair = InternalSchemaCache
+        
.getInternalSchemaAndAvroSchemaForClusteringAndCompaction(table.getMetaClient(),
 compactionInstantTime);
+
+    if (schemaPair.getLeft().isPresent()) {
+      commitMetadata.addMetadata(SerDeHelper.LATEST_SCHEMA, 
schemaPair.getLeft().get());
+      commitMetadata.addMetadata(HoodieCommitMetadata.SCHEMA_KEY, 
schemaPair.getRight().get());
+    }
+    // Setting operationType, which is compact.

Review Comment:
   which is log compact



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