You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/03/19 14:56:54 UTC

[GitHub] [incubator-iceberg] rdsr commented on a change in pull request #854: Fix ConcateCloseableIterable issue with starting empty iterables

rdsr commented on a change in pull request #854: Fix ConcateCloseableIterable issue with starting empty iterables
URL: https://github.com/apache/incubator-iceberg/pull/854#discussion_r395089732
 
 

 ##########
 File path: api/src/main/java/org/apache/iceberg/io/CloseableIterable.java
 ##########
 @@ -130,6 +130,20 @@ public O next() {
       private ConcatCloseableIterator(Iterable<CloseableIterable<E>> inputs) {
         this.iterables = inputs.iterator();
         this.currentIterable = iterables.next();
+        // Exhaust the starting empty iterables.
+        while (Iterables.isEmpty(currentIterable)) {
 
 Review comment:
   Would it be simpler to simply call `hasNext` in `next` method? like so
   ```
   @Override
         public E next() {
           if (hasNext()) {
             return currentIterator.next();
           } else {
             throw new NoSuchElementException();
           }
         }
   ```
   
   My understanding is we can keep calling `hasNext` as many times as we want until we consume that element from the Iterator. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org