From ee466bcac14bd7f1229beeaf4e405da0956792ca Mon Sep 17 00:00:00 2001 From: Jingsong Date: Tue, 26 Nov 2024 13:07:43 +0800 Subject: [PATCH] [core] CleanOrphanFilesResult.deletedFilesPath should be nullable --- .../paimon/operation/CleanOrphanFilesResult.java | 16 +++++++++++----- .../paimon/operation/LocalOrphanFilesClean.java | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/operation/CleanOrphanFilesResult.java b/paimon-core/src/main/java/org/apache/paimon/operation/CleanOrphanFilesResult.java index 5a3bc67f9c95..d29eede720ac 100644 --- a/paimon-core/src/main/java/org/apache/paimon/operation/CleanOrphanFilesResult.java +++ b/paimon-core/src/main/java/org/apache/paimon/operation/CleanOrphanFilesResult.java @@ -20,24 +20,29 @@ import org.apache.paimon.fs.Path; +import javax.annotation.Nullable; + import java.util.List; /** The result of OrphanFilesClean. */ public class CleanOrphanFilesResult { - private List deletedFilesPath; private final long deletedFileCount; private final long deletedFileTotalLenInBytes; + @Nullable private final List deletedFilesPath; + public CleanOrphanFilesResult(long deletedFileCount, long deletedFileTotalLenInBytes) { - this.deletedFileCount = deletedFileCount; - this.deletedFileTotalLenInBytes = deletedFileTotalLenInBytes; + this(deletedFileCount, deletedFileTotalLenInBytes, null); } public CleanOrphanFilesResult( - List deletedFilesPath, long deletedFileCount, long deletedFileTotalLenInBytes) { - this(deletedFileCount, deletedFileTotalLenInBytes); + long deletedFileCount, + long deletedFileTotalLenInBytes, + @Nullable List deletedFilesPath) { this.deletedFilesPath = deletedFilesPath; + this.deletedFileCount = deletedFileCount; + this.deletedFileTotalLenInBytes = deletedFileTotalLenInBytes; } public long getDeletedFileCount() { @@ -48,6 +53,7 @@ public long getDeletedFileTotalLenInBytes() { return deletedFileTotalLenInBytes; } + @Nullable public List getDeletedFilesPath() { return deletedFilesPath; } diff --git a/paimon-core/src/main/java/org/apache/paimon/operation/LocalOrphanFilesClean.java b/paimon-core/src/main/java/org/apache/paimon/operation/LocalOrphanFilesClean.java index 511c5fc7fb79..6a4276662468 100644 --- a/paimon-core/src/main/java/org/apache/paimon/operation/LocalOrphanFilesClean.java +++ b/paimon-core/src/main/java/org/apache/paimon/operation/LocalOrphanFilesClean.java @@ -101,7 +101,7 @@ public CleanOrphanFilesResult clean() Map> candidates = getCandidateDeletingFiles(); if (candidates.isEmpty()) { return new CleanOrphanFilesResult( - deleteFiles, deleteFiles.size(), deletedFilesLenInBytes.get()); + deleteFiles.size(), deletedFilesLenInBytes.get(), deleteFiles); } candidateDeletes = new HashSet<>(candidates.keySet()); @@ -128,7 +128,7 @@ public CleanOrphanFilesResult clean() candidateDeletes.clear(); return new CleanOrphanFilesResult( - deleteFiles, deleteFiles.size(), deletedFilesLenInBytes.get()); + deleteFiles.size(), deletedFilesLenInBytes.get(), deleteFiles); } private void collectWithoutDataFile(