Paul Lin created FLINK-28685:
--------------------------------

             Summary: Optimize CatalogManager getTable implementation
                 Key: FLINK-28685
                 URL: https://issues.apache.org/jira/browse/FLINK-28685
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / API
    Affects Versions: 1.16.0
            Reporter: Paul Lin


Currently, Catalog#getTable(ObjectPath) might be abused in CatalogManager. 
CatalogManager gets an ObjectPath directly, instead of checking the existence 
of the table first, which could surprise Catalog developers and may get 
unexpected exceptions other than TableNotFoundExceptions. 

```
    private Optional<CatalogBaseTable> getUnresolvedTable(ObjectIdentifier 
objectIdentifier) {
        Catalog currentCatalog = 
catalogs.get(objectIdentifier.getCatalogName());
        ObjectPath objectPath = objectIdentifier.toObjectPath();
        if (currentCatalog != null) {
            try {
                final CatalogBaseTable table = 
currentCatalog.getTable(objectPath);
                return Optional.of(table);
            } catch (TableNotExistException e) {
                // Ignore.
            }
        }
        return Optional.empty();
    }
```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to