mukund-thakur commented on code in PR #15341:
URL: https://github.com/apache/iceberg/pull/15341#discussion_r2962719856


##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/BaseReader.java:
##########
@@ -166,9 +196,13 @@ public void close() throws IOException {
     // close the current iterator
     this.currentIterator.close();

Review Comment:
   close either the parallel or serial iterator?



##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/BaseReader.java:
##########
@@ -134,6 +156,14 @@ public boolean next() throws IOException {
         if (currentIterator.hasNext()) {
           this.current = currentIterator.next();
           return true;
+        } else if (isAsyncEnabled) {
+          this.currentIterator.close();

Review Comment:
   In case of async you don't need to close this as it was never opened. I 
think the flow will be 
   if (isAsyncEnabled) 
   use parallelIterator 
   else 
   use currentIterator ( maybe we can rename this is sequentialIterator.) 



##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/BaseReader.java:
##########
@@ -89,15 +94,32 @@ abstract class BaseReader<T, TaskT extends ScanTask> 
implements Closeable {
       boolean cacheDeleteFilesOnExecutors) {
     this.table = table;
     this.taskGroup = taskGroup;
-    this.tasks = taskGroup.tasks().iterator();
     this.currentIterator = CloseableIterator.empty();

Review Comment:
   currentIterator shouldn't be initialized in case of async I think. 



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