kasakrisz commented on code in PR #3362:
URL: https://github.com/apache/hive/pull/3362#discussion_r907549301


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergOutputCommitter.java:
##########
@@ -127,14 +133,23 @@ public void commitTask(TaskAttemptContext 
originalContext) throws IOException {
           .run(output -> {
             Table table = 
HiveIcebergStorageHandler.table(context.getJobConf(), output);
             if (table != null) {
-              HiveIcebergWriter writer = writers.get(output);
+              Collection<DataFile> dataFiles = Lists.newArrayList();
+              Collection<DeleteFile> deleteFiles = Lists.newArrayList();
               String fileForCommitLocation = 
generateFileForCommitLocation(table.location(), jobConf,
-                  attemptID.getJobID(), attemptID.getTaskID().getId());
-              if (writer != null) {
-                createFileForCommit(writer.files(), fileForCommitLocation, 
table.io());
-              } else {
+                      attemptID.getJobID(), attemptID.getTaskID().getId());
+              if (writers.get(output) != null) {

Review Comment:
   The writer can be null if we don't write anything like
   ```
   INSERT OVERWRITE TABLE target SELECT * FROM source WHERE FALSE
   ``` 
   In this case output is not null but the writers map does not have an entry 
for the key.
   
   I moved the null check before the for loop iterates through the writers.
   
   I think it does not worth converting this loop to use the streaming api 
because `createFileForCommit` can throw `IOException` and IMHO this would add 
additional complexity because of the try-catch block in the lambda expression.



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