deniskuzZ commented on code in PR #6039:
URL: https://github.com/apache/hive/pull/6039#discussion_r2290994816
##########
standalone-metastore/metastore-client/src/main/java/org/apache/hadoop/hive/metastore/utils/TableFetcher.java:
##########
@@ -110,24 +114,29 @@ public List<TableName> getTableNames() throws Exception {
return candidates;
}
- public List<Table> getTables(int maxBatchSize) throws Exception {
- List<Table> candidates = new ArrayList<>();
-
+ public Iterable<Table> getTables(int maxBatchSize) throws Exception {
// 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;
+ return Collections.emptyList();
}
List<String> databases = client.getDatabases(catalogName, dbPattern);
- for (String db : databases) {
- List<String> tablesNames = getTableNamesForDatabase(catalogName, db);
- for (Table table : new TableIterable(client, db, tablesNames,
maxBatchSize)) {
- candidates.add(table);
+ return () -> databases.stream().flatMap(db -> {
Review Comment:
that is a wrong implementation! we shouldn't initialize multiple
TableIterable eagerly (1 per database)
--
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]