vikramahuja1001 commented on code in PR #6012:
URL: https://github.com/apache/hive/pull/6012#discussion_r2259708418
##########
standalone-metastore/metastore-client/src/main/java/org/apache/hadoop/hive/metastore/utils/TableFetcher.java:
##########
@@ -117,6 +118,33 @@ public List<TableName> getTables() throws Exception {
return candidates;
}
+ public List<Table> getTables() throws Exception {
+ List<Table> candidates = new ArrayList<>();
+
+ // if tableTypes is empty, then a list with single empty string has to
specified to scan no tables.
+ if (tableTypes.isEmpty()) {
+ LOG.info("Table fetcher returns empty list as no table types specified");
+ return candidates;
+ }
+
+ List<String> databases = client.getDatabases(catalogName, dbPattern);
+
+ for (String db : databases) {
+ Database database = client.getDatabase(catalogName, db);
+ if (MetaStoreUtils.checkIfDbNeedsToBeSkipped(database)) {
+ LOG.debug("Skipping table under database: {}", db);
+ continue;
+ }
+ if (MetaStoreUtils.isDbBeingPlannedFailedOver(database)) {
+ LOG.info("Skipping table that belongs to database {} being failed
over.", db);
+ continue;
+ }
+ List<Table> tables = client.listTablesByFilter(catalogName, db,
tableFilter, -1);
Review Comment:
Can you implement Batching in it?
client.listTablesByFilter(catalogName, db, tableFilter, -1) can potentially
return a very large object if the db has large number of tables.
Please refer to TableIterable, PartitionIterable classes and their uses to
get an idea of how hive uses batched calls to fetch from the metastore.
--
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]