diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java index 980e369dd3ba0be..2e8b160cd413b8a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonExternalTable.java @@ -89,14 +89,7 @@ protected synchronized void makeSureInitialized() { } public Table getPaimonTable(Optional snapshot) { - PaimonSnapshot paimonSnapshot = getOrFetchSnapshotCacheValue(snapshot).getSnapshot(); - Table table = paimonSnapshot.getTable(); - // TODO mmc -// if (paimonSnapshot.getSnapshotId() == PaimonSnapshot.INVALID_SNAPSHOT_ID) { -// Env.getCurrentEnv().getExtMetaCacheMgr().getPaimonMetadataCache() -// .invalidateTableCache(catalog.getId(), dbName, name); -// } - return table; + return getOrFetchSnapshotCacheValue(snapshot).getSnapshot().getTable(); } public PaimonSchemaCacheValue getPaimonSchemaCacheValue(long schemaId) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonMetadataCache.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonMetadataCache.java index 0e3c34ab6e6f147..cf433ae3017d4c3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonMetadataCache.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/PaimonMetadataCache.java @@ -18,15 +18,12 @@ package org.apache.doris.datasource.paimon; import org.apache.doris.catalog.Column; -import org.apache.doris.catalog.Env; import org.apache.doris.common.AnalysisException; import org.apache.doris.common.CacheFactory; import org.apache.doris.common.Config; import org.apache.doris.datasource.CacheException; import org.apache.doris.datasource.CatalogIf; import org.apache.doris.datasource.ExternalMetaCacheMgr; -import org.apache.doris.datasource.ExternalSchemaCache; -import org.apache.doris.datasource.SchemaCacheValue; import com.github.benmanes.caffeine.cache.LoadingCache; import com.google.common.collect.Maps; @@ -40,7 +37,6 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.OptionalLong; import java.util.concurrent.ExecutorService; @@ -66,15 +62,6 @@ private PaimonSnapshotCacheValue loadSnapshot(PaimonSnapshotCacheKey key) { .getTableOrAnalysisException(key.getTableName()); List partitionColumns = table.getPaimonSchemaCacheValue(latestSnapshot.getSchemaId()) .getPartitionColumns(); - // TODO mmc -// ExternalSchemaCache cache = Env.getCurrentEnv().getExtMetaCacheMgr().getSchemaCache(catalog); -// Optional schemaCacheValue = cache.getSchemaValue( -// new PaimonSchemaCacheKey(dbName, name, schemaId)); -// if (!schemaCacheValue.isPresent()) { -// throw new CacheException("failed to getSchema for: %s.%s.%s.%s", -// null, catalog.getName(), dbName, name, schemaId); -// } -// return (PaimonSchemaCacheValue) schemaCacheValue.get(); PaimonPartitionInfo partitionInfo = loadPartitionInfo(key, partitionColumns); return new PaimonSnapshotCacheValue(partitionInfo, latestSnapshot); } catch (IOException | AnalysisException e) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/source/PaimonScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/source/PaimonScanNode.java index 0e9a8042a65f960..6d3ed11a4b20ec7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/source/PaimonScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/paimon/source/PaimonScanNode.java @@ -44,6 +44,7 @@ import com.google.common.collect.Sets; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.paimon.CoreOptions; import org.apache.paimon.data.BinaryRow; import org.apache.paimon.predicate.Predicate; import org.apache.paimon.table.source.DataSplit; @@ -207,6 +208,9 @@ public List getSplits(int numBackends) throws UserException { SessionVariable.IgnoreSplitType ignoreSplitType = SessionVariable.IgnoreSplitType .valueOf(sessionVariable.getIgnoreSplitType()); List splits = new ArrayList<>(); + if (!source.getPaimonTable().options().containsKey(CoreOptions.SCAN_SNAPSHOT_ID.key())) { + return splits; + } int[] projected = desc.getSlots().stream().mapToInt( slot -> source.getPaimonTable().rowType() .getFieldNames()