Dandandan commented on code in PR #16322:
URL: https://github.com/apache/datafusion/pull/16322#discussion_r2137474689


##########
datafusion/physical-plan/src/sorts/merge.rs:
##########
@@ -216,36 +212,50 @@ impl<C: CursorValues> SortPreservingMergeStream<C> {
         // Once all partitions have set their corresponding cursors for the 
loser tree,
         // we skip the following block. Until then, this function may be 
called multiple
         // times and can return Poll::Pending if any partition returns 
Poll::Pending.
+
         if self.loser_tree.is_empty() {
-            while let Some(&partition_idx) = 
self.uninitiated_partitions.front() {
+            // Manual indexing since we're iterating over the vector and 
shrinking it in the loop
+            let mut idx = 0;
+            while idx < self.uninitiated_partitions.len() {

Review Comment:
   > Suppose uninitiated_partitions is [1, 2, 3] and in the first round 1 and 3 
are pending, but 2 is ready. Next round you only want to poll 1 and 3 again. 
How would you keep track of that with just a counter?
   
   Yeah, you're right



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to