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


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -115,42 +126,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());
       }
-
-      LOG.debug(
-          "Listing of namespace: {} resulted in the following tables: {}",
-          namespace,
-          tableIdentifiers);

Review Comment:
   Did we intentionally removed this log line?



##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -115,42 +126,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());
       }
-
-      LOG.debug(
-          "Listing of namespace: {} resulted in the following tables: {}",
-          namespace,
-          tableIdentifiers);

Review Comment:
   Did we intentionally remove this log line?



-- 
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