You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Paul Lin (Jira)" <ji...@apache.org> on 2022/07/26 04:25:00 UTC

[jira] [Created] (FLINK-28685) Optimize CatalogManager getTable implementation

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)