kalencaya opened a new issue, #8769:
URL: https://github.com/apache/gravitino/issues/8769

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   gravitino provides flink catalog implementions for jdbc、hive、iceberg、paimon 
and not support flink catalogs `#listViews(String)` method and throws 
`UnsupportedOperationException`. Some code as follow:
   
   `org.apache.gravitino.flink.connector.catalog.BaseCatalog`
   ```
       public List<String> listViews(String s) throws 
DatabaseNotExistException, CatalogException {
           throw new UnsupportedOperationException();
       }
   ```
   
   Then gravition jdbc catalog throws `UnsupportedOperationException` too. But 
flink sql gateway will try to get views info and conflicts with gravitino flink 
catalogs, use gravitino flink connector and flink sql gateway together is 
impossible.
   
   `org.apache.flink.table.gateway.service.operation`
   ```
   
       private Set<TableInfo> listTables(
               String catalogName, String databaseName, boolean includeViews) {
           CatalogManager catalogManager = 
sessionContext.getSessionState().catalogManager;
           Map<String, TableInfo> views = new HashMap<>();
           // gravitino flink catalogs always throw exception
           catalogManager
                   .listViews(catalogName, databaseName)
                   .forEach(
                           name ->
                                   views.put(
                                           name,
                                           new TableInfo(
                                                   ObjectIdentifier.of(
                                                           catalogName, 
databaseName, name),
                                                   TableKind.VIEW)));
   
           Map<String, TableInfo> ans = new HashMap<>();
           if (includeViews) {
               ans.putAll(views);
           }
           catalogManager.listTables(catalogName, databaseName).stream()
                   .filter(name -> !views.containsKey(name))
                   .forEach(
                           name ->
                                   ans.put(
                                           name,
                                           new TableInfo(
                                                   ObjectIdentifier.of(
                                                           catalogName, 
databaseName, name),
                                                   TableKind.TABLE)));
           return Collections.unmodifiableSet(new HashSet<>(ans.values()));
       }
   ```
   
   I know that gravitino doesn't support view and throw exception is ok, but as 
gravitino flink catalogs wrap flink's jdbc、hive、iceberg、paimon implementions, 
`BaseCatalog` can access wrapped catalog through `BaseCatalog#realCatalog()` 
method, `#listViews(String)` method can also be proxyed to flink catalogs 
implementions as follow:
   
   ```
       // proxyed to wrapped catalog
       public List<String> listViews(String s) throws 
DatabaseNotExistException, CatalogException {
           return this.realCatalog().listViews(s);
       }
   
   ```
   
   
   
   
   ### Error message and/or stacktrace
   
   none
   
   ### How to reproduce
   
   none
   
   ### Additional context
   
   _No response_


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