mchades commented on code in PR #11189:
URL: https://github.com/apache/gravitino/pull/11189#discussion_r3301758176


##########
flink-connector/flink-common/src/main/java/org/apache/gravitino/flink/connector/catalog/BaseCatalog.java:
##########
@@ -210,32 +225,70 @@ public List<String> listTables(String databaseName)
   @Override
   public List<String> listViews(String databaseName)
       throws DatabaseNotExistException, CatalogException {
-    // Gravitino does not support views yet; return empty to keep Flink 
callers happy.
-    return Collections.emptyList();
+    try {
+      ViewCatalog viewCatalog = catalog().asViewCatalog();
+      // TODO: Currently returns all VIRTUAL_VIEW entries from the underlying 
catalog regardless of
+      // dialect. Views created by other engines (e.g. Trino, Spark) may 
appear here but will fail
+      // when Flink attempts to load them. Consider filtering to only dialects 
that Flink can handle
+      // (hive, flink), but this requires per-view property inspection which 
is expensive.
+      return Arrays.stream(viewCatalog.listViews(Namespace.of(databaseName)))
+          .map(NameIdentifier::name)
+          .collect(Collectors.toList());
+    } catch (UnsupportedOperationException e) {
+      LOG.debug("Catalog {} does not support views; returning empty view 
list", catalogName(), e);
+      return Collections.emptyList();

Review Comment:
   The default behavior should throw an unsupported error. 



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

Reply via email to