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_r339229704
########## File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java ########## @@ -258,13 +456,34 @@ public void createTable(CatalogBaseTable table, ObjectIdentifier objectIdentifie "CreateTable"); } + /** + * Creates a temporary table in a given fully qualified path. + * + * @param table The table to put in the given path. + * @param objectIdentifier The fully qualified path where to put the table. + * @param replace controls what happens if a table exists in the given path, + * if true the table is replaced, an exception will be thrown otherwise + */ + public void createTemporaryTable( + CatalogBaseTable table, + ObjectIdentifier objectIdentifier, + boolean replace) { + temporaryTables.compute(objectIdentifier, (k, v) -> { + if (v != null && !replace) { + throw new ValidationException(String.format("Temporary table %s already exists", objectIdentifier)); + } else { + return table; + } + }); + } + /** * Alters a table in a given fully qualified path. * * @param table The table to put in the given path * @param objectIdentifier The fully qualified path where to alter the table. * @param ignoreIfNotExists If false exception will be thrown if the table or database or catalog to be altered - * does not exist. + * does not exist. Review comment: minor: revert ---------------------------------------------------------------- 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