marton-bod commented on code in PR #3131:
URL: https://github.com/apache/hive/pull/3131#discussion_r847343603
##########
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:
Thanks for checking! I've refactored the `commitDelete` and `commitInsert`
to use an optional Transaction object, which can be passed in case of an update
or merge query.
--
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]