martin-g commented on code in PR #19785:
URL: https://github.com/apache/datafusion/pull/19785#discussion_r2686214181
##########
datafusion/physical-plan/src/filter.rs:
##########
@@ -26,8 +26,8 @@ use super::{
ColumnStatistics, DisplayAs, ExecutionPlanProperties, PlanProperties,
RecordBatchStream, SendableRecordBatchStream, Statistics,
};
-use crate::coalesce::LimitedBatchCoalescer;
use crate::coalesce::PushBatchStatus::LimitReached;
Review Comment:
`PushBatchStatus` is imported below, so `LimitReached` variant could be used
as `PushBatchStatus::LimitReached`.
##########
datafusion/physical-plan/src/filter.rs:
##########
@@ -802,37 +802,22 @@ impl Stream for FilterExecStream {
})?;
timer.done();
- if let LimitReached = status {
- poll = self.flush_remaining_batches();
- break;
- }
-
- if let Some(batch) =
self.batch_coalescer.next_completed_batch() {
- self.metrics.selectivity.add_part(batch.num_rows());
- poll = Poll::Ready(Some(Ok(batch)));
- break;
- }
- continue;
- }
- None => {
- // Flush any remaining buffered batch
- match self.batch_coalescer.finish() {
- Ok(()) => {
- poll = self.flush_remaining_batches();
+ match status {
+ PushBatchStatus::Continue => {
+ // Keep pushing more batches
}
- Err(e) => {
- poll = Poll::Ready(Some(Err(e)));
+ LimitReached => {
Review Comment:
```suggestion
PushBatchStatus::LimitReached => {
```
##########
datafusion/physical-plan/src/coalesce/mod.rs:
##########
@@ -134,6 +134,10 @@ impl LimitedBatchCoalescer {
Ok(())
}
+ pub fn is_finished(&self) -> bool {
Review Comment:
```suggestion
pub(crate) fn is_finished(&self) -> bool {
```
##########
datafusion/physical-plan/src/filter.rs:
##########
@@ -802,37 +802,22 @@ impl Stream for FilterExecStream {
})?;
timer.done();
- if let LimitReached = status {
- poll = self.flush_remaining_batches();
- break;
- }
-
- if let Some(batch) =
self.batch_coalescer.next_completed_batch() {
- self.metrics.selectivity.add_part(batch.num_rows());
- poll = Poll::Ready(Some(Ok(batch)));
- break;
- }
- continue;
- }
- None => {
- // Flush any remaining buffered batch
- match self.batch_coalescer.finish() {
- Ok(()) => {
- poll = self.flush_remaining_batches();
+ match status {
+ PushBatchStatus::Continue => {
+ // Keep pushing more batches
}
- Err(e) => {
- poll = Poll::Ready(Some(Err(e)));
+ LimitReached => {
+ // limit was reached, so stop early
+ self.batch_coalescer.finish()?
Review Comment:
```suggestion
self.batch_coalescer.finish()?;
```
--
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]