anxkhn commented on code in PR #17150:
URL: https://github.com/apache/iceberg/pull/17150#discussion_r3593056139


##########
core/src/main/java/org/apache/iceberg/avro/AvroIterable.java:
##########
@@ -83,7 +83,16 @@ public CloseableIterator<D> iterator() {
             .setRowPositionSupplier(
                 Suppliers.memoize(() -> 
AvroIO.findStartingRowPos(file::newStream, start)));
       }
-      fileReader = new AvroRangeIterator<>(fileReader, start, end);
+      try {

Review Comment:
   Addressed by moving the guard above row-position setup.



##########
core/src/main/java/org/apache/iceberg/avro/AvroIterable.java:
##########
@@ -83,7 +83,16 @@ public CloseableIterator<D> iterator() {
             .setRowPositionSupplier(
                 Suppliers.memoize(() -> 
AvroIO.findStartingRowPos(file::newStream, start)));
       }
-      fileReader = new AvroRangeIterator<>(fileReader, start, end);
+      try {
+        fileReader = new AvroRangeIterator<>(fileReader, start, end);
+      } catch (RuntimeException e) {
+        try {
+          fileReader.close();
+        } catch (IOException closeException) {
+          e.addSuppressed(closeException);

Review Comment:
   Addressed by making close fail and asserting the suppressed exception.



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