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: Refactor group by state machine #7025

Closed
wants to merge 2 commits into from

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jul 19, 2023

Which issue does this PR close?

Follow on to #6932

Rationale for this change

I was a little unhappy about the extract_ok! macro and @tustvold
offered a suggestion on how to remove it: https://github.com/apache/arrow-datafusion/pull/6932/files#r1267309181

This PR is what I came up with . I am not really sure it is better but wanted to put it up in case others had an opinion

What changes are included in this PR?

Pull out the state machine transition logic in group by into some new functions and remove the extract_ok! macro

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added physical-expr Changes to the physical-expr crates core Core DataFusion crate labels Jul 19, 2023
@alamb alamb force-pushed the alamb/less_state branch from a4106d9 to 3a5c8ad Compare July 19, 2023 10:58
@github-actions github-actions bot removed the physical-expr Changes to the physical-expr crates label Jul 19, 2023
@@ -322,16 +322,6 @@ fn create_group_accumulator(
}
}

/// Extracts a successful Ok(_) or returns Poll::Ready(Some(Err(e))) with errors
macro_rules! extract_ok {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This macro was removed, but I think breaking the main state loop change into two different functions makes is slightly harder to follow the logic.

Thus I am inclined not to pursue this PR anymore

Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

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

I happen to like that this splits out the transition functions from the state machine proper, but I don't feel strongly

@alamb alamb marked this pull request as ready for review July 19, 2023 21:00
@alamb
Copy link
Contributor Author

alamb commented Jul 22, 2023

I think I am inclined to leave this code alone for now as it has already undergone a bunch of churn and this is just stylistic and I want to move on to other things. If anyone else feels differently, please feel free to open a new PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants