alamb commented on code in PR #4421:
URL: https://github.com/apache/arrow-datafusion/pull/4421#discussion_r1034939706


##########
datafusion/core/src/physical_plan/filter.rs:
##########
@@ -238,15 +238,31 @@ impl Stream for FilterExecStream {
         mut self: Pin<&mut Self>,
         cx: &mut Context<'_>,
     ) -> Poll<Option<Self::Item>> {
-        let poll = self.input.poll_next_unpin(cx).map(|x| match x {
-            Some(Ok(batch)) => {
-                let timer = self.baseline_metrics.elapsed_compute().timer();
-                let filtered_batch = batch_filter(&batch, &self.predicate);
-                timer.done();
-                Some(filtered_batch)
+        let poll;
+        loop {
+            match self.input.poll_next_unpin(cx) {
+                Poll::Ready(value) => match value {
+                    Some(Ok(batch)) => {
+                        let timer = 
self.baseline_metrics.elapsed_compute().timer();
+                        let filtered_batch = batch_filter(&batch, 
&self.predicate)?;
+                        if filtered_batch.num_rows() == 0 {

Review Comment:
   ```suggestion
                           // skip entirely filtered batches
                           if filtered_batch.num_rows() == 0 {
   ```



-- 
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...@arrow.apache.org

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

Reply via email to