This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 309c8dacbd [core] Use priority queue intead of tree set. TreeSet will 
deduplicate record if comparator return 0 (#5162)
309c8dacbd is described below

commit 309c8dacbd87a3c7f2cb9a7fd2453b37721aa5ef
Author: YeJunHao <[email protected]>
AuthorDate: Wed Feb 26 17:10:58 2025 +0800

    [core] Use priority queue intead of tree set. TreeSet will deduplicate 
record if comparator return 0 (#5162)
---
 .../org/apache/paimon/append/BucketedAppendCompactManager.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/append/BucketedAppendCompactManager.java
 
b/paimon-core/src/main/java/org/apache/paimon/append/BucketedAppendCompactManager.java
index 02f469624c..e461c579b8 100644
--- 
a/paimon-core/src/main/java/org/apache/paimon/append/BucketedAppendCompactManager.java
+++ 
b/paimon-core/src/main/java/org/apache/paimon/append/BucketedAppendCompactManager.java
@@ -42,7 +42,7 @@ import java.util.Comparator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Optional;
-import java.util.TreeSet;
+import java.util.PriorityQueue;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 
@@ -57,7 +57,7 @@ public class BucketedAppendCompactManager extends 
CompactFutureManager {
 
     private final ExecutorService executor;
     private final DeletionVectorsMaintainer dvMaintainer;
-    private final TreeSet<DataFileMeta> toCompact;
+    private final PriorityQueue<DataFileMeta> toCompact;
     private final int minFileNum;
     private final int maxFileNum;
     private final long targetFileSize;
@@ -78,7 +78,7 @@ public class BucketedAppendCompactManager extends 
CompactFutureManager {
             @Nullable CompactionMetrics.Reporter metricsReporter) {
         this.executor = executor;
         this.dvMaintainer = dvMaintainer;
-        this.toCompact = new TreeSet<>(fileComparator(false));
+        this.toCompact = new PriorityQueue<>(fileComparator(false));
         this.toCompact.addAll(restored);
         this.minFileNum = minFileNum;
         this.maxFileNum = maxFileNum;
@@ -197,7 +197,7 @@ public class BucketedAppendCompactManager extends 
CompactFutureManager {
         LinkedList<DataFileMeta> candidates = new LinkedList<>();
 
         while (!toCompact.isEmpty()) {
-            DataFileMeta file = toCompact.pollFirst();
+            DataFileMeta file = toCompact.poll();
             candidates.add(file);
             totalFileSize += file.fileSize();
             fileNum++;
@@ -217,7 +217,7 @@ public class BucketedAppendCompactManager extends 
CompactFutureManager {
     }
 
     @VisibleForTesting
-    TreeSet<DataFileMeta> getToCompact() {
+    PriorityQueue<DataFileMeta> getToCompact() {
         return toCompact;
     }
 

Reply via email to