rdblue commented on issue #150: Close open manifests during scan planning.
URL: https://github.com/apache/incubator-iceberg/pull/150#issuecomment-479965518
 
 
   @rdsr, the approach here is for usability. `CloseableIterable` can be used 
in a try-with-resources block because it keeps track of iterators that are 
created within that block. If we used the `Iterator` interface for closing, 
then we wouldn't be able to use `for` loops, like this:
   
   ```java
   try (CloseableIterable<T> items = ...) {
     for (T item : items) {
       ...
     }
   }
   ```
   
   Because the iterator for items is never explicitly handled, we can't call 
close on it.
   
   We could have that iterator close the underlying resource when it is 
exhausted, but that would leak resources if the iterator isn't exhausted.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to