mayursrivastava commented on a change in pull request #2933:
URL: https://github.com/apache/iceberg/pull/2933#discussion_r686489755



##########
File path: 
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowReader.java
##########
@@ -252,17 +297,10 @@ public boolean hasNext() {
         }
       } catch (IOException | RuntimeException e) {
         if (currentTask != null && !currentTask.isDataTask()) {
-          throw new RuntimeException(

Review comment:
       The change will be the following:
   
   ```diff
   --- 
a/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowReader.java
   +++ 
b/arrow/src/main/java/org/apache/iceberg/arrow/vectorized/ArrowReader.java
   @@ -25,6 +25,7 @@ import java.util.Collection;
    import java.util.Iterator;
    import java.util.List;
    import java.util.Map;
   +import java.util.NoSuchElementException;
    import java.util.stream.Collectors;
    import java.util.stream.Stream;
    import java.util.stream.StreamSupport;
   @@ -172,7 +173,6 @@ public class ArrowReader extends CloseableGroup {
        private final int batchSize;
        private final boolean reuseContainers;
        private CloseableIterator<ColumnarBatch> currentIterator;
   -    private ColumnarBatch current;
        private FileScanTask currentTask;
    
        /**
   @@ -239,7 +239,6 @@ public class ArrowReader extends CloseableGroup {
          try {
            while (true) {
              if (currentIterator.hasNext()) {
   -            this.current = currentIterator.next();
                return true;
              } else if (fileItr.hasNext()) {
                this.currentIterator.close();
   @@ -268,7 +267,11 @@ public class ArrowReader extends CloseableGroup {
    
        @Override
        public ColumnarBatch next() {
   -      return current;
   +      if (currentIterator.hasNext()) {
   +        return currentIterator.next();
   +      } else {
   +        throw new NoSuchElementException();
   +      }
        }
   ```
   
   The exception handling will not change. This is similar to he 
CloseableIterable.hasNext().




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