Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor: use ready! macro to simplify FilterExec #11649

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jul 25, 2024

Which issue does this PR close?

Closes #.

Rationale for this change

The poll loops of the Streams in the execution form the core state control. It is useful for them to be as simple as possible so the state machine is easy to understand

While working on #11647 I noticed we could simplify the poll loop in FilterExec using the ready! macro.

What changes are included in this PR?

Use the standard ready! macro to avoid code repetition

Are these changes tested?

By existing CI

Are there any user-facing changes?

poll = Poll::Ready(Some(Ok(filtered_batch)));
break;
}
value => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ready! macro returns 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

@alamb alamb marked this pull request as ready for review July 25, 2024 11:57
Copy link
Contributor

@edmondop edmondop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! This will make reviewing #11647 easier for sure

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks @alamb

@Dandandan Dandandan merged commit 71903e1 into apache:main Jul 25, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants