danny0405 commented on a change in pull request #9093:
[FLINK-13220][FLINK-13211] [flink-table] Add drop table support for flink
planner and add DDL support for blink planner
URL: https://github.com/apache/flink/pull/9093#discussion_r302810245
##########
File path:
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/api/internal/TableEnvImpl.scala
##########
@@ -457,6 +458,23 @@ abstract class TableEnvImpl(
registerCatalogTableInternal(operation.getTablePath,
operation.getCatalogTable,
operation.isIgnoreIfExists)
+ case dropTable: SqlDropTable =>
+ val name = dropTable.fullTableName()
+ val isIfExists = dropTable.getIfExists
+ val paths = catalogManager.getFullTablePath(name.toList)
+ val catalog = getCatalog(paths(0))
+ if (!catalog.isPresent) {
+ if (!isIfExists) {
+ throw new TableException(s"Catalog ${paths(0)} does not exist.")
+ }
+ } else {
+ try
+ catalog.get().dropTable(new ObjectPath(paths(1), paths(2)),
isIfExists)
+ catch {
+ case e: TableNotExistException =>
+ throw new TableException(e.getMessage)
+ }
+ }
case _ =>
throw new TableException(
"Unsupported SQL query! sqlUpdate() only accepts SQL statements of
type INSERT.")
Review comment:
Updated
----------------------------------------------------------------
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]
With regards,
Apache Git Services