jinxing64 commented on code in PR #5564: URL: https://github.com/apache/hudi/pull/5564#discussion_r873331963
########## 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: In existing code, RT and RO tables are dropped only when purging a MOR table; This PR respects the current behavior. From my point, such logic makes sense and acceptable for the user. ########## 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: In existing code, RT and RO tables are dropped only when purging a MOR table; This PR respects the current behavior. From my point, such logic makes sense and acceptable for the user. -- 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-unsubscr...@hudi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org