pvary commented on a change in pull request #2178:
URL: https://github.com/apache/hive/pull/2178#discussion_r613122594
##########
File path:
iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergOutputCommitter.java
##########
@@ -143,19 +145,30 @@ public void commitJob(JobContext originalContext) throws
IOException {
LOG.info("Committing job has started for table: {}, using location: {}",
table,
generateJobLocation(conf, jobContext.getJobID()));
- FileIO io = HiveIcebergStorageHandler.io(jobContext.getJobConf());
- List<DataFile> dataFiles = dataFiles(jobContext, io, true);
-
- if (dataFiles.size() > 0) {
+ List<DataFile> dataFiles = dataFiles(jobContext, table.io(), true);
+
+ boolean isOverwrite = conf.getBoolean(InputFormatConfig.IS_OVERWRITE,
false);
+ if (isOverwrite) {
+ // Replacing affected partitions (or whole table) since it's an insert
overwrite
+ // We do the replacement even for 0 data files (i.e. empty source)
+ ReplacePartitions overwrite = table.newReplacePartitions();
+ dataFiles.forEach(overwrite::addFile);
+ overwrite.commit();
Review comment:
More like not committing if not necessary...
But with the funny logic around partitions this sounds hard to check anyway
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]