chamikaramj commented on code in PR #40980:
URL: https://github.com/apache/beam/pull/40980#discussion_r4555383823
##########
sdks/java/extensions/sorter/src/main/java/org/apache/beam/sdk/extensions/sorter/NativeFileSorter.java:
##########
@@ -204,7 +206,12 @@ public KV<byte[], byte[]> next() {
private @Nullable KV<byte[], byte[]> readKeyValueOrFail(InputStream
inputStream) {
try {
- return readKeyValue(inputStream);
+ @Nullable KV<byte[], byte[]> kv = readKeyValue(inputStream);
+ if (kv == null) {
+ // The block is used up: release its file handle now
+ inputStream.close();
Review Comment:
Seems like this will be skipped if the `readKeyValue` call raises an
exception (for example, EOF).
--
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]