pvary commented on code in PR #8907:
URL: https://github.com/apache/iceberg/pull/8907#discussion_r1384740902


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -115,42 +129,13 @@ public void initialize(String inputName, Map<String, 
String> properties) {
 
   @Override
   public List<TableIdentifier> listTables(Namespace namespace) {
-    Preconditions.checkArgument(
-        isValidateNamespace(namespace), "Missing database in namespace: %s", 
namespace);
-    String database = namespace.level(0);
 
     try {
-      List<String> tableNames = clients.run(client -> 
client.getAllTables(database));
-      List<TableIdentifier> tableIdentifiers;
-
       if (listAllTables) {
-        tableIdentifiers =
-            tableNames.stream()
-                .map(t -> TableIdentifier.of(namespace, t))
-                .collect(Collectors.toList());
+        return listContents(namespace, null, table -> true);
       } else {
-        List<Table> tableObjects =
-            clients.run(client -> client.getTableObjectsByName(database, 
tableNames));
-        tableIdentifiers =
-            tableObjects.stream()
-                .filter(
-                    table ->
-                        table.getParameters() != null
-                            && 
BaseMetastoreTableOperations.ICEBERG_TABLE_TYPE_VALUE
-                                .equalsIgnoreCase(
-                                    table
-                                        .getParameters()
-                                        
.get(BaseMetastoreTableOperations.TABLE_TYPE_PROP)))
-                .map(table -> TableIdentifier.of(namespace, 
table.getTableName()))
-                .collect(Collectors.toList());
+        return listContents(namespace, TableType.EXTERNAL_TABLE.name(), 
icebergPredicate());

Review Comment:
   I would prefer 2 different methods:
   - listAllTables
   - listSpecificTables
   
   If we do this way, we do not need the parameter, and the 2 methods 
implementations is only similar in a single HMS call



##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -168,6 +153,11 @@ public String name() {
     return name;
   }
 
+  @Override
+  public boolean tableExists(TableIdentifier identifier) {
+    return HiveCatalogUtil.isTableWithTypeExists(clients, identifier, 
TableType.EXTERNAL_TABLE);
+  }

Review Comment:
   Not used anymore - should be removed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to