southernriver commented on code in PR #4605:
URL: https://github.com/apache/iceberg/pull/4605#discussion_r855702108


##########
mr/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergOutputCommitter.java:
##########
@@ -285,16 +288,33 @@ private void commitTable(FileIO io, ExecutorService 
executor, JobContext jobCont
 
     Collection<DataFile> dataFiles = dataFiles(executor, location, jobContext, 
io, true);
 
-    if (dataFiles.size() > 0) {
+    boolean isOverwrite = conf.getBoolean(ConfigProperties.IS_OVERWRITE, 
false);
+
+    if (isOverwrite) {
+      if (!dataFiles.isEmpty()) {
+        ReplacePartitions overwrite = table.newReplacePartitions();
+        dataFiles.forEach(overwrite::addFile);
+        overwrite.commit();
+        LOG.info("Overwrite commit took {} ms for table: {} with {} file(s)", 
System.currentTimeMillis() - startTime,
+          table, dataFiles.size());
+      } else if (table.spec().isUnpartitioned()) {
+        
table.newDelete().deleteFromRowFilter(Expressions.alwaysTrue()).commit();
+        LOG.info("Cleared table contents as part of empty overwrite for 
unpartitioned table. " +
+          "Commit took {} ms for table: {}", System.currentTimeMillis() - 
startTime, table);
+      }

Review Comment:
   Not do anything, I added some log.



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