leesf commented on a change in pull request #4455:
URL: https://github.com/apache/hudi/pull/4455#discussion_r775714498



##########
File path: 
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/DropHoodieTableCommand.scala
##########
@@ -85,25 +91,42 @@ case class DropHoodieTableCommand(
   }
 
   private def dropHiveDataSourceTable(
-        sparkSession: SparkSession,
-        table: CatalogTable,
-        ifExists: Boolean,
-        purge: Boolean): Unit = {
+       sparkSession: SparkSession,
+       hoodieCatalogTable: HoodieCatalogTable): Unit = {
+    val table = hoodieCatalogTable.table
     val dbName = table.identifier.database.get
     val tableName = table.identifier.table
+
     // check database exists
     val dbExists = sparkSession.sessionState.catalog.databaseExists(dbName)
     if (!dbExists) {
       throw new NoSuchDatabaseException(dbName)
     }
-    // check table exists
-    if (!sparkSession.sessionState.catalog.tableExists(table.identifier)) {
-      throw new NoSuchTableException(dbName, table.identifier.table)
+
+    if (HoodieTableType.MERGE_ON_READ == hoodieCatalogTable.tableType && 
purge) {
+      val snapshotTableName = hoodieCatalogTable.tableName + 
SUFFIX_SNAPSHOT_TABLE
+      val roTableName = hoodieCatalogTable.tableName + 
SUFFIX_READ_OPTIMIZED_TABLE
+
+      dropHiveTable(sparkSession, dbName, snapshotTableName)
+      dropHiveTable(sparkSession, dbName, roTableName)
+      dropHiveTable(sparkSession, dbName, hoodieCatalogTable.tableName, purge)

Review comment:
       why still need the original tableName?




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


Reply via email to