[GitHub] [flink] docete commented on a change in pull request #11917: [FLINK-15591][table] Support create/drop temporary table in Flink SQL
docete commented on a change in pull request #11917: URL: https://github.com/apache/flink/pull/11917#discussion_r415627411 ## File path: flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/api/TableEnvironmentTest.scala ## @@ -137,6 +137,28 @@ class TableEnvironmentTest { .tableExists(ObjectPath.fromString(s"${tableEnv.getCurrentDatabase}.tbl1"))) } + @Test + def testExecuteSqlWithCreateDropTemporaryTable(): Unit = { Review comment: The ITCase `testTemporaryTableMaskPermanentTableWithSameName` test co-exists cases. ## File path: flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/api/TableEnvironmentTest.scala ## @@ -137,6 +137,28 @@ class TableEnvironmentTest { .tableExists(ObjectPath.fromString(s"${tableEnv.getCurrentDatabase}.tbl1"))) } + @Test + def testExecuteSqlWithCreateDropTemporaryTable(): Unit = { Review comment: `show tables` show both temporary and permanent tables 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
[GitHub] [flink] docete commented on a change in pull request #11917: [FLINK-15591][table] Support create/drop temporary table in Flink SQL
docete commented on a change in pull request #11917: URL: https://github.com/apache/flink/pull/11917#discussion_r415691459 ## 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: `TableEnvironment#dropTemporaryTable` and `dropTemporaryView` also return `boolean` which is consistent with `CatalogManager#dropTemporaryTable` and `dropTemporaryView`. Shall we refactor these interfaces in another ticket? 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
[GitHub] [flink] docete commented on a change in pull request #11917: [FLINK-15591][table] Support create/drop temporary table in Flink SQL
docete commented on a change in pull request #11917: URL: https://github.com/apache/flink/pull/11917#discussion_r417059442 ## 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: OK. I can refactor the CatalogManager first. 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