pvary commented on code in PR #3131:
URL: https://github.com/apache/hive/pull/3131#discussion_r846716331


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergOutputCommitter.java:
##########
@@ -325,9 +327,40 @@ private void commitTable(FileIO io, ExecutorService 
executor, JobContext jobCont
           "numReduceTasks/numMapTasks", jobContext.getJobID(), name);
       return conf.getNumReduceTasks() > 0 ? conf.getNumReduceTasks() : 
conf.getNumMapTasks();
     });
-    Collection<DataFile> dataFiles = dataFiles(numTasks, executor, location, 
jobContext, io, true);
 
-    boolean isOverwrite = conf.getBoolean(InputFormatConfig.IS_OVERWRITE, 
false);
+    if (HiveIcebergStorageHandler.isDelete(conf, name)) {
+      Collection<FilesForCommit> writeResults = collectResults(numTasks, 
executor, location, jobContext, io, true);
+      commitDelete(jobContext, table, startTime, writeResults);
+    } else if (HiveIcebergStorageHandler.isWrite(conf, name)) {
+      Collection<FilesForCommit> writeResults = collectResults(numTasks, 
executor, location, jobContext, io, true);
+      boolean isOverwrite = conf.getBoolean(InputFormatConfig.IS_OVERWRITE, 
false);
+      commitInsert(jobContext, table, startTime, writeResults, isOverwrite);
+    } else {
+      LOG.info("Unable to determine commit operation type for table: {}, 
jobID: {}. Will not create a commit.",
+          table, jobContext.getJobID());
+    }
+  }
+
+  private void commitDelete(JobContext jobContext, Table table, long 
startTime, Collection<FilesForCommit> results) {

Review Comment:
   After playing around with update, i think we will have 2 methods in the end:
   - InsertOverwrite
   - RowUpdate (I still have to check what happens, if there is no insert or 
delete), but the other part of the code is the same. If rowupdate does not work 
we can fall back to Transaction



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