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 139b5a75a5 [core] Improve the performance of show tables (#4592)
139b5a75a5 is described below
commit 139b5a75a5f0b89bc9d9c91f8c06dfb68691c9e0
Author: xleoken <[email protected]>
AuthorDate: Tue Nov 26 17:00:45 2024 +0800
[core] Improve the performance of show tables (#4592)
---
.../main/java/org/apache/paimon/catalog/AbstractCatalog.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git
a/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java
b/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java
index d3a8d628a2..16b76513d7 100644
--- a/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java
+++ b/paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java
@@ -653,7 +653,16 @@ public abstract class AbstractCatalog implements Catalog {
}
protected boolean tableExistsInFileSystem(Path tablePath, String
branchName) {
- return !new SchemaManager(fileIO, tablePath,
branchName).listAllIds().isEmpty();
+ SchemaManager schemaManager = new SchemaManager(fileIO, tablePath,
branchName);
+
+ // in order to improve the performance, check the schema-0 firstly.
+ boolean schemaZeroExists = schemaManager.schemaExists(0);
+ if (schemaZeroExists) {
+ return true;
+ } else {
+ // if schema-0 not exists, fallback to check other schemas
+ return !schemaManager.listAllIds().isEmpty();
+ }
}
public Optional<TableSchema> tableSchemaInFileSystem(Path tablePath,
String branchName) {