This is an automated email from the ASF dual-hosted git repository. forwardxu pushed a commit to branch release-0.12.1 in repository https://gitbox.apache.org/repos/asf/hudi.git
commit 4f005ea5d4532c6434548e0858b336fe6a30dd42 Author: XuQianJin-Stars <forwar...@apache.com> AuthorDate: Fri Dec 30 17:28:47 2022 +0800 improve DropHoodieTableCommand --- .../spark/sql/hudi/command/DropHoodieTableCommand.scala | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/command/DropHoodieTableCommand.scala b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/command/DropHoodieTableCommand.scala index a0252861db..f9cae4369d 100644 --- a/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/command/DropHoodieTableCommand.scala +++ b/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/command/DropHoodieTableCommand.scala @@ -70,16 +70,17 @@ case class DropHoodieTableCommand( val basePath = hoodieCatalogTable.tableLocation val catalog = sparkSession.sessionState.catalog + val hoodieTableExists = hoodieCatalogTable.hoodieTableExists + val tableType = hoodieCatalogTable.tableType // Drop table in the catalog - if (hoodieCatalogTable.hoodieTableExists && - HoodieTableType.MERGE_ON_READ == hoodieCatalogTable.tableType && purge) { + if (hoodieTableExists && HoodieTableType.MERGE_ON_READ == tableType && purge) { val (rtTableOpt, roTableOpt) = getTableRTAndRO(catalog, hoodieCatalogTable) - rtTableOpt.foreach(table => catalog.dropTable(table.identifier, true, false)) - roTableOpt.foreach(table => catalog.dropTable(table.identifier, true, false)) - catalog.dropTable(table.identifier.copy(table = hoodieCatalogTable.tableName), ifExists, purge) + rtTableOpt.foreach(table => catalog.dropTable(table.identifier, ignoreIfNotExists = true, purge = false)) + roTableOpt.foreach(table => catalog.dropTable(table.identifier, ignoreIfNotExists = true, purge = false)) + catalog.dropTable(table.identifier.copy(table = hoodieCatalogTable.tableName), ignoreIfNotExists = true, purge = purge) } else { - catalog.dropTable(table.identifier, ifExists, purge) + catalog.dropTable(table.identifier, ignoreIfNotExists = true, purge = purge) } // Recursively delete table directories