alamb commented on code in PR #11649:
URL: https://github.com/apache/datafusion/pull/11649#discussion_r1691313462
##########
datafusion/physical-plan/src/filter.rs:
##########
@@ -375,26 +376,20 @@ impl Stream for FilterExecStream {
) -> Poll<Option<Self::Item>> {
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)?;
- // skip entirely filtered batches
- if filtered_batch.num_rows() == 0 {
- continue;
- }
- timer.done();
- poll = Poll::Ready(Some(Ok(filtered_batch)));
- break;
+ match ready!(self.input.poll_next_unpin(cx)) {
+ Some(Ok(batch)) => {
+ let timer =
self.baseline_metrics.elapsed_compute().timer();
+ let filtered_batch = batch_filter(&batch,
&self.predicate)?;
+ // skip entirely filtered batches
+ if filtered_batch.num_rows() == 0 {
+ continue;
}
- _ => {
- poll = Poll::Ready(value);
- break;
- }
- },
- Poll::Pending => {
- poll = Poll::Pending;
+ timer.done();
+ poll = Poll::Ready(Some(Ok(filtered_batch)));
+ break;
+ }
+ value => {
Review Comment:
The `ready!` macro `return`s if the poll is not ready:
https://doc.rust-lang.org/std/task/macro.ready.html
This does skip calling `baseline_metrics.record_poll` below, however, that
doesn't do anything with `PollPending`:
https://docs.rs/datafusion-physical-plan/40.0.0/src/datafusion_physical_plan/metrics/baseline.rs.html#127
--
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]