You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/05/16 03:59:12 UTC

[GitHub] [hudi] XuQianJin-Stars commented on a diff in pull request #5564: [HUDI-4087] Support dropping RO and RT table in DropHoodieTableCommand

XuQianJin-Stars commented on code in PR #5564:
URL: https://github.com/apache/hudi/pull/5564#discussion_r873305945


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/command/DropHoodieTableCommand.scala:
##########
@@ -69,13 +67,13 @@ extends HoodieLeafRunnableCommand {
     val catalog = sparkSession.sessionState.catalog
 
     // Drop table in the catalog
-    val enableHive = isEnableHive(sparkSession)
-    if (enableHive) {
-      dropHiveDataSourceTable(sparkSession, hoodieCatalogTable)
+    if (HoodieTableType.MERGE_ON_READ == hoodieCatalogTable.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)
     } else {
-      if (catalog.tableExists(tableIdentifier)) {
-        catalog.dropTable(tableIdentifier, ifExists, purge)
-      }
+      catalog.dropTable(table.identifier, ifExists, purge)

Review Comment:
   `purge` is false  and `HoodieTableType.MERGE_ON_READ == hoodieCatalogTable.tableType` Don't need to drop `ro` and `rt` table? 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org