2010YOUY01 commented on code in PR #27595:
URL: https://github.com/apache/datafusion/pull/27595#discussion_r4678167490


##########
datafusion/physical-plan/src/coalesce/mod.rs:
##########
@@ -307,6 +340,20 @@ mod tests {
         assert_next_batch_values(&mut coalescer, vec![1, 4, 5]);
     }
 
+    #[test]
+    fn test_push_batch_with_indices_and_fetch() {
+        let batch = uint32_batch(0..8);
+        let indices = UInt32Array::from(vec![7, 1, 5, 3]);
+        let mut coalescer = LimitedBatchCoalescer::new(batch.schema(), 100, 
Some(3));
+
+        assert_eq!(
+            coalescer.push_batch_with_indices(batch, &indices).unwrap(),
+            PushBatchStatus::LimitReached,
+        );
+        coalescer.finish().unwrap();
+        assert_next_batch_values(&mut coalescer, vec![7, 1, 5]);
+    }
+

Review Comment:
   I suggest to include more test coverage, like:
   - limit is reached after pushing multiple batches
   - limit is greater than target batch size
   - indices array is empty/imcompatible type/include out-of-range indices



##########
datafusion/physical-plan/src/coalesce/mod.rs:
##########
@@ -113,6 +113,39 @@ impl LimitedBatchCoalescer {
         Ok(PushBatchStatus::Continue)
     }
 
+    /// Pushes the rows selected by `indices` from the next [`RecordBatch`]
+    /// into the coalescer and returns its status.

Review Comment:
   We could take (or just put the link) arrow `BatchCoalescer`'s comment here



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