jinxing64 commented on code in PR #5564:
URL: https://github.com/apache/hudi/pull/5564#discussion_r873491449
##########
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:
I think it should be fine. The `ro` and `rt` is left with NO-PURGE, user can
also drop them separately case by case.
Just like the test of `Test("Test Drop RO & RT table by one by one.")`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]