comphead commented on code in PR #19775:
URL: https://github.com/apache/datafusion/pull/19775#discussion_r2691337076


##########
datafusion/physical-plan/src/repartition/mod.rs:
##########
@@ -591,33 +592,46 @@ impl BatchPartitioner {
 
                     // Borrowing partitioner timer to prevent moving `self` to 
closure
                     let partitioner_timer = &self.timer;
-                    let it = indices
-                        .into_iter()
-                        .enumerate()
-                        .filter_map(|(partition, indices)| {
-                            let indices: PrimitiveArray<UInt32Type> = 
indices.into();
-                            (!indices.is_empty()).then_some((partition, 
indices))
-                        })
-                        .map(move |(partition, indices)| {
+
+                    let mut partitioned_batches = vec![];
+                    for (partition, p_indices) in 
indices.iter_mut().enumerate() {
+                        if !p_indices.is_empty() {
+                            let taken_indices = std::mem::take(p_indices);

Review Comment:
   just wondering if we can use `drain` 
https://doc.rust-lang.org/std/vec/struct.Vec.html#method.drain so you can get 
rid of clearing them? 



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