tejasiyer-dev commented on code in PR #40543:
URL: https://github.com/apache/beam/pull/40543#discussion_r4606710176
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/io/WriteFiles.java:
##########
@@ -923,30 +991,56 @@ public void finishBundle(FinishBundleContext c) throws
Exception {
BoundedWindow window = evictedResult.getWindow();
c.output(evictedResult, window.maxTimestamp(), window);
}
- for (Map.Entry<WriterKey<DestinationT>, Writer<DestinationT, OutputT>>
entry :
- writers.entrySet()) {
- WriterKey<DestinationT> key = entry.getKey();
- Writer<DestinationT, OutputT> writer = entry.getValue();
- try {
- writer.close();
- } catch (Exception e) {
- // If anything goes wrong, make sure to delete the temporary file.
- writer.cleanup();
- throw e;
- }
- BoundedWindow window = key.window;
- c.output(
- new FileResult<>(
- writer.getOutputFile(), UNKNOWN_SHARDNUM, window,
key.paneInfo, key.destination),
- window.maxTimestamp(),
- window);
- }
+ closeAllWritersAndOutputFileResults(writers, c);
writers.clear();
evictedFileResults.clear();
}
}
}
+ private Writer<DestinationT, OutputT> openAndRegisterWriter(
+ Map<WriterKey<DestinationT>, Writer<DestinationT, OutputT>> writers,
Review Comment:
No, we don't need to. Since DirectWriteRecordsFn is gone, only
WriteUnshardedTempFilesFn uses it, so I moved openAndRegisterWriter back into
that class, where it uses the writers field directly.
--
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]