KurtYoung commented on a change in pull request #11917:
URL: https://github.com/apache/flink/pull/11917#discussion_r416394563



##########
File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java
##########
@@ -649,16 +649,32 @@ public void sqlUpdate(String stmt) {
        private TableResult executeOperation(Operation operation) {
                if (operation instanceof CreateTableOperation) {
                        CreateTableOperation createTableOperation = 
(CreateTableOperation) operation;
-                       catalogManager.createTable(
-                                       createTableOperation.getCatalogTable(),
-                                       
createTableOperation.getTableIdentifier(),
-                                       
createTableOperation.isIgnoreIfExists());
+                       if (createTableOperation.isTemporary()) {
+                               catalogManager.createTemporaryTable(
+                                               
createTableOperation.getCatalogTable(),
+                                               
createTableOperation.getTableIdentifier(),
+                                               
createTableOperation.isIgnoreIfExists());
+                       } else {
+                               catalogManager.createTable(
+                                               
createTableOperation.getCatalogTable(),
+                                               
createTableOperation.getTableIdentifier(),
+                                               
createTableOperation.isIgnoreIfExists());
+                       }
                        return TableResultImpl.TABLE_RESULT_OK;
                } else if (operation instanceof DropTableOperation) {
                        DropTableOperation dropTableOperation = 
(DropTableOperation) operation;
-                       catalogManager.dropTable(
-                                       dropTableOperation.getTableIdentifier(),
-                                       dropTableOperation.isIfExists());
+                       if (dropTableOperation.isTemporary()) {
+                               boolean dropped = 
catalogManager.dropTemporaryTable(dropTableOperation.getTableIdentifier());

Review comment:
       Since we are talking about CatalogManager's interface, I think it's make 
sense to compare the interfaces belong to CatalogManager. It looks a bit 
strange that some of the 'ignoreIfNotExists' logic is happened inside 
CatalogManager, but some of them are handled out of CatalogManager. I would 
suggest to keep it consistent. 




----------------------------------------------------------------
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:
[email protected]


Reply via email to