terrytlu commented on code in PR #17317:
URL: https://github.com/apache/iceberg/pull/17317#discussion_r3638801876


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -354,6 +370,48 @@ private List<TableIdentifier> listIcebergTables(
         .collect(Collectors.toList());
   }
 
+  /**
+   * Lists the {@link TableIdentifier} of all Iceberg tables under the given 
database.
+   *
+   * <p>Implementation uses the HMS {@code get_table_names_by_filter} API, 
filtering on {@code
+   * parameters.table_type} on the server side so that only matching table 
names (rather than full
+   * Table objects) are returned.
+   *
+   * @param namespace the namespace corresponding to the database
+   * @param tableTypeValue the value of {@code parameters.table_type} to 
filter on, e.g. {@link
+   *     BaseMetastoreTableOperations#ICEBERG_TABLE_TYPE_VALUE} for tables. 
HMS normalizes this
+   *     value to upper case when persisting it, so the filter value is 
upper-cased to match.
+   */
+  private List<TableIdentifier> listIcebergTablesByFilter(
+      Namespace namespace, String tableTypeValue) throws TException, 
InterruptedException {
+    String database = namespace.level(0);
+    // HMS normalizes the `table_type` parameter value to upper case when 
persisting it
+    // (e.g. "iceberg" is stored as "ICEBERG"), so the filter value must be 
upper-cased to match.
+    String filter =
+        hive_metastoreConstants.HIVE_FILTER_FIELD_PARAMS
+            + BaseMetastoreTableOperations.TABLE_TYPE_PROP
+            + " like \""
+            + tableTypeValue.toUpperCase(Locale.ROOT)
+            + "\"";
+
+    // maxTables = -1 means no limit on the number of returned tables.

Review Comment:
   Done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to