martin-g commented on code in PR #18783:
URL: https://github.com/apache/datafusion/pull/18783#discussion_r2535419305


##########
datafusion/physical-plan/src/coalesce/mod.rs:
##########
@@ -120,6 +120,22 @@ impl LimitedBatchCoalescer {
         Ok(PushBatchStatus::Continue)
     }
 
+    /// Pushes the batch into this coalescer, after applying the filter
+    pub fn push_batch_with_filter(
+        &mut self,
+        batch: RecordBatch,
+        filter: &arrow::array::BooleanArray,
+    ) -> Result<PushBatchStatus> {
+        // If there is a limit, fall back to the non-optimized path
+        if self.fetch.is_some() {
+            self.push_batch(filter_record_batch(&batch, filter)?)
+        } else {
+            // use optimized path when no fetch limit is set
+            self.inner.push_batch_with_filter(batch, filter)?;

Review Comment:
   What about the `total_rows` ? Does it need to be updated in the optimized 
path ?



##########
datafusion/physical-plan/src/coalesce/mod.rs:
##########
@@ -120,6 +120,22 @@ impl LimitedBatchCoalescer {
         Ok(PushBatchStatus::Continue)
     }
 
+    /// Pushes the batch into this coalescer, after applying the filter
+    pub fn push_batch_with_filter(
+        &mut self,
+        batch: RecordBatch,
+        filter: &arrow::array::BooleanArray,
+    ) -> Result<PushBatchStatus> {
+        // If there is a limit, fall back to the non-optimized path

Review Comment:
   There is no check for `self.finished` as in `push_batch()`.



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