pan3793 commented on code in PR #7370:
URL: https://github.com/apache/kyuubi/pull/7370#discussion_r3000685609


##########
extensions/spark/kyuubi-spark-connector-hive/src/main/scala/org/apache/kyuubi/spark/connector/hive/HiveTableCatalog.scala:
##########
@@ -392,14 +393,23 @@ class HiveTableCatalog(sparkSession: SparkSession)
       loadTable(ident)
     }
 
-  override def dropTable(ident: Identifier): Boolean =
+  override def purgeTable(ident: Identifier): Boolean = {
+    dropTableInternal(ident, purge = true)
+  }
+
+  override def dropTable(ident: Identifier): Boolean = {
+    val purge = sessionState.conf.getConf(DROP_TABLE_WITH_PURGE)
+    dropTableInternal(ident, purge = purge)

Review Comment:
   ```suggestion
       dropTableInternal(ident, purge)
   ```



##########
extensions/spark/kyuubi-spark-connector-hive/src/main/scala/org/apache/kyuubi/spark/connector/hive/HiveTableCatalog.scala:
##########
@@ -392,14 +393,23 @@ class HiveTableCatalog(sparkSession: SparkSession)
       loadTable(ident)
     }
 
-  override def dropTable(ident: Identifier): Boolean =
+  override def purgeTable(ident: Identifier): Boolean = {
+    dropTableInternal(ident, purge = true)
+  }
+
+  override def dropTable(ident: Identifier): Boolean = {
+    val purge = sessionState.conf.getConf(DROP_TABLE_WITH_PURGE)
+    dropTableInternal(ident, purge = purge)
+  }
+
+  private def dropTableInternal(ident: Identifier, purge: Boolean): Boolean =
     withSparkSQLConf(LEGACY_NON_IDENTIFIER_OUTPUT_CATALOG_NAME -> "true") {
       try {
         if (loadTable(ident) != null) {
           catalog.dropTable(
             ident.asTableIdentifier,
             ignoreIfNotExists = true,
-            purge = true /* skip HDFS trash */ )
+            purge = purge)

Review Comment:
   purge is a connector-specific behavior, let's keep the comment
   
   ```suggestion
               purge /* whether to skip HDFS trash */)
   ```



##########
extensions/spark/kyuubi-spark-connector-hive/src/main/scala/org/apache/kyuubi/spark/connector/hive/KyuubiHiveConnectorConf.scala:
##########
@@ -57,4 +57,12 @@ object KyuubiHiveConnectorConf {
       .version("1.11.0")
       .booleanConf
       .createWithDefault(true)
+
+  val DROP_TABLE_WITH_PURGE =
+    buildConf("spark.sql.kyuubi.hive.connector.dropTableWithPurge")
+      .doc("When enabled, the DROP TABLE command will completely remove its 
data " +
+        "by skipping trash, equivalent to the PURGE TABLE command.")
+      .version("1.12.0")
+      .booleanConf
+      .createWithDefault(false)

Review Comment:
   I would use `dropTableAsPurgeTable`.
   
   S3/COS-based FileSystem may have different behavior, let's say "skipping 
HDFS trash"
   
   we should make the default value match the built-in Hive data source 
behavior. could you please double-check that?
   
   ```suggestion
       buildConf("spark.sql.kyuubi.hive.connector.dropTableAsPurgeTable")
         .doc("When enabled, the DROP TABLE command will completely remove its 
data " +
           "by skipping HDFS trash, equivalent to the PURGE TABLE command.")
         .version("1.12.0")
         .booleanConf
         .createWithDefault(true)
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to