bowenli86 commented on a change in pull request #9971: [FLINK-14490][table] Add methods for interacting with temporary objects URL: https://github.com/apache/flink/pull/9971#discussion_r339234275
########## File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java ########## @@ -477,6 +478,41 @@ public void createTemporaryTable( }); } + /** + * Qualifies the given {@link UnresolvedIdentifier} with current catalog & database and + * removes a temporary table registered with this path if it exists. + * + * @param identifier potentially unresolved identifier + * @return true if a table with a given identifier existed and was removed, false otherwise + */ + public boolean dropTemporaryTable(UnresolvedIdentifier identifier) { + return doDropTemporaryTable(identifier, (table) -> table instanceof CatalogTable); + } + + /** + * Qualifies the given {@link UnresolvedIdentifier} with current catalog & database and + * removes a temporary view registered with this path if it exists. + * + * @param identifier potentially unresolved identifier + * @return true if a view with a given identifier existed and was removed, false otherwise + */ + public boolean dropTemporaryView(UnresolvedIdentifier identifier) { + return doDropTemporaryTable(identifier, (table) -> table instanceof CatalogView); + } + + private boolean doDropTemporaryTable( Review comment: the API naming of "doXxx()" feels a bit weird. rename to `dropTemporaryTableInternal()`? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services