tsreaper commented on code in PR #2224:
URL: https://github.com/apache/incubator-paimon/pull/2224#discussion_r1384279055


##########
paimon-core/src/main/java/org/apache/paimon/compact/CompactTask.java:
##########
@@ -19,28 +19,57 @@
 package org.apache.paimon.compact;
 
 import org.apache.paimon.io.DataFileMeta;
+import org.apache.paimon.operation.metrics.CompactionMetrics;
+import org.apache.paimon.operation.metrics.CompactionStats;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.Nullable;
+
+import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.Callable;
 
 /** Compact task. */
 public abstract class CompactTask implements Callable<CompactResult> {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(CompactTask.class);
+    private CompactionMetrics metrics;

Review Comment:
   NIT: This member can be final. Also please add `@Nullable`.



##########
paimon-core/src/main/java/org/apache/paimon/mergetree/compact/MergeTreeCompactManager.java:
##########
@@ -53,21 +56,25 @@ public class MergeTreeCompactManager extends 
CompactFutureManager {
     private final int numSortedRunStopTrigger;
     private final CompactRewriter rewriter;
 
+    private final CompactionMetrics metrics;

Review Comment:
   Add `@Nullable`.



##########
paimon-core/src/main/java/org/apache/paimon/table/sink/TableWriteImpl.java:
##########
@@ -146,6 +156,18 @@ public void compact(BinaryRow partition, int bucket, 
boolean fullCompaction) thr
         write.compact(partition, bucket, fullCompaction);
     }
 
+    @Override
+    public TableWrite withMetricRegistry(MetricRegistry registry, BinaryRow 
partition, int bucket) {
+        write.withMetrics(
+                new CompactionMetrics(registry, tableName, 
getPartitionString(partition), bucket));
+        return this;
+    }

Review Comment:
   One `TableWrite` (and also one `FileStoreWrite`) is responsible for writing 
all partitions and buckets of a table. You can't specify partitions and buckets 
here. Please check `AbstractFileStoreWrite` to understand how writers for 
different buckets are grouped together.



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