From cd6808bc8c62a4b40a9bb01ff0a1969daab3aca2 Mon Sep 17 00:00:00 2001 From: Jingsong Date: Sun, 11 Aug 2024 20:02:37 +0800 Subject: [PATCH] [core] Check bucket only cache enabled for scan in write --- .../main/java/org/apache/paimon/manifest/ManifestFile.java | 4 ++++ .../org/apache/paimon/operation/AbstractFileStoreScan.java | 2 +- .../java/org/apache/paimon/utils/SnapshotManagerTest.java | 4 ---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFile.java b/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFile.java index 2f5cb4f2369d..5bd558854314 100644 --- a/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFile.java +++ b/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFile.java @@ -192,6 +192,10 @@ public Factory( this.cache = cache; } + public boolean isCacheEnabled() { + return cache != null; + } + public ManifestFile create() { RowType entryType = VersionedObjectSerializer.versionType(ManifestEntry.schema()); return new ManifestFile( diff --git a/paimon-core/src/main/java/org/apache/paimon/operation/AbstractFileStoreScan.java b/paimon-core/src/main/java/org/apache/paimon/operation/AbstractFileStoreScan.java index 2c753e27095e..358a2722fdc1 100644 --- a/paimon-core/src/main/java/org/apache/paimon/operation/AbstractFileStoreScan.java +++ b/paimon-core/src/main/java/org/apache/paimon/operation/AbstractFileStoreScan.java @@ -148,7 +148,7 @@ public FileStoreScan withBucketFilter(Filter bucketFilter) { @Override public FileStoreScan withPartitionBucket(BinaryRow partition, int bucket) { - if (manifestCacheFilter != null) { + if (manifestCacheFilter != null && manifestFileFactory.isCacheEnabled()) { checkArgument( manifestCacheFilter.test(partition, bucket), String.format( diff --git a/paimon-core/src/test/java/org/apache/paimon/utils/SnapshotManagerTest.java b/paimon-core/src/test/java/org/apache/paimon/utils/SnapshotManagerTest.java index b1e0384809d8..0c17e2a5eae5 100644 --- a/paimon-core/src/test/java/org/apache/paimon/utils/SnapshotManagerTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/utils/SnapshotManagerTest.java @@ -30,12 +30,8 @@ import java.io.IOException; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; -import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail;