zhangbutao commented on code in PR #5052:
URL: https://github.com/apache/hive/pull/5052#discussion_r1473826357


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergOutputCommitter.java:
##########
@@ -549,16 +550,27 @@ private void commitOverwrite(Table table, String 
branchName, long startTime, Fil
     if (!results.dataFiles().isEmpty()) {
       Transaction transaction = table.newTransaction();
       if (rewritePolicy == RewritePolicy.ALL_PARTITIONS) {
-        DeleteFiles delete = transaction.newDelete();
-        delete.deleteFromRowFilter(Expressions.alwaysTrue());
-        delete.commit();
-      }
-      ReplacePartitions overwrite = transaction.newReplacePartitions();
-      results.dataFiles().forEach(overwrite::addFile);
-      if (StringUtils.isNotEmpty(branchName)) {
-        overwrite.toBranch(HiveUtils.getTableSnapshotRef(branchName));
+
+        List<DataFile> existingDataFiles = Lists.newArrayList();
+        List<DeleteFile> existingDeleteFiles = Lists.newArrayList();
+        IcebergTableUtil.getFiles(table, existingDataFiles, 
existingDeleteFiles);

Review Comment:
   Since the Major QB Compaction is essentially a `IOW `operation, why don't we 
follow the regular `IOW `flow?  Why do we need the extra operation to find the 
existing data and delete files? 
   Just reuse the  `ReplacePartitions  `api:
   
https://github.com/apache/hive/blob/e08a60029f93e52182908b61fff32e8659e78daa/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergOutputCommitter.java#L556-L561



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