boneanxs commented on code in PR #8076:
URL: https://github.com/apache/hudi/pull/8076#discussion_r1201423428


##########
hudi-spark-datasource/hudi-spark3.2plus-common/src/main/scala/org/apache/spark/sql/hudi/catalog/HoodieInternalV2Table.scala:
##########
@@ -106,8 +106,14 @@ private class HoodieV1WriteBuilder(writeOptions: 
CaseInsensitiveStringMap,
     override def toInsertableRelation: InsertableRelation = {
       new InsertableRelation {
         override def insert(data: DataFrame, overwrite: Boolean): Unit = {
+          val mode = if (overwriteTable || overwritePartition) {

Review Comment:
   WIth this pr, it won't delete the basePath.
   
   ```scala
   // HoodieSparkSqlWriter#handleSaveModes
   // won't delete the path if it's Overwrite mode and INSERT_OVERWRITE_TABLE, 
INSERT_OVERWRITE
   
   else if (mode == SaveMode.Overwrite && tableExists &&
           (operation != WriteOperationType.INSERT_OVERWRITE_TABLE
             && operation != WriteOperationType.INSERT_OVERWRITE
             && operation != WriteOperationType.BULK_INSERT)) {
           // For INSERT_OVERWRITE_TABLE, INSERT_OVERWRITE and BULK_INSERT with 
Overwrite mode,
           // we'll use replacecommit to overwrite the old data.
           log.warn(s"hoodie table at $tablePath already exists. Deleting 
existing data & overwriting with new data.")
           fs.delete(tablePath, true)
           tableExists = false
         }
   ```



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