drexler-sky commented on code in PR #16891:
URL: https://github.com/apache/iceberg/pull/16891#discussion_r3479408832
##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:
##########
@@ -368,6 +369,31 @@ public Identifier[] listTables(String[] namespace) {
.toArray(Identifier[]::new);
}
+ @Override
+ public TableSummary[] listTableSummaries(String[] namespace) {
+ // Build summaries directly from the catalog listings to avoid loading
every table, which the
+ // default TableCatalog.listTableSummaries implementation would do.
Iceberg tables are always
+ // reported as EXTERNAL (see SparkTable#properties), and views are
reported as VIEW.
+ List<TableSummary> summaries = Lists.newArrayList();
+
+ // Collect views first. Most catalogs return only tables from listTables,
but HiveCatalog with
+ // list-all-tables=true returns every metastore entry, including views.
De-duplicate against the
+ // view identifiers so a view is never also reported as a table.
+ Set<Identifier> viewIdents = Sets.newHashSet(listViews(namespace));
Review Comment:
The `listTableSummaries` Javadoc says views should be included(`"views
should be listed as well"`). That being said, I am happy to exclude views and
mirror the default's tables-only behavior if you would prefer. Which way would
you like?
--
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]