Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#8984] Improvement(paimon): Remove the redundant schemaExists() check in PaimonCatalogOperations.listTables() (#8985)

Xiaojian Sunc3c32fa98a7e
diff --git a/catalogs/catalog-lakehouse-paimon/src/main/java/org/apache/gravitino/catalog/lakehouse/paimon/PaimonCatalogOperations.java b/catalogs/catalog-lakehouse-paimon/src/main/java/org/apache/gravitino/catalog/lakehouse/paimon/PaimonCatalogOperations.java
index 6fca33b283..cbcc024170 100644
--- a/catalogs/catalog-lakehouse-paimon/src/main/java/org/apache/gravitino/catalog/lakehouse/paimon/PaimonCatalogOperations.java
+++ b/catalogs/catalog-lakehouse-paimon/src/main/java/org/apache/gravitino/catalog/lakehouse/paimon/PaimonCatalogOperations.java
@@ -269,15 +269,14 @@ public class PaimonCatalogOperations implements CatalogOperations, SupportsSchem
public NameIdentifier[] listTables(Namespace namespace) throws NoSuchSchemaException {
String[] levels = namespace.levels();
NameIdentifier schemaIdentifier = NameIdentifier.of(levels[levels.length - 1]);
- if (!schemaExists(schemaIdentifier)) {
- throw new NoSuchSchemaException(NO_SUCH_SCHEMA_EXCEPTION, namespace.toString());
- }
+
List<String> tables;
try {
tables = paimonCatalogOps.listTables(schemaIdentifier.name());
} catch (Catalog.DatabaseNotExistException e) {
- throw new NoSuchSchemaException(NO_SUCH_SCHEMA_EXCEPTION, namespace.toString());
+ throw new NoSuchSchemaException(e, NO_SUCH_SCHEMA_EXCEPTION, namespace.toString());
}
+
return tables.stream()
.map(
tableIdentifier ->