Skip to content

Minor: Refactor group by state machine - #7025

Closed
alamb wants to merge 2 commits into
apache:mainfrom
alamb:alamb/less_state
Closed

Minor: Refactor group by state machine#7025
alamb wants to merge 2 commits into
apache:mainfrom
alamb:alamb/less_state

Conversation

@alamb

Copy link
Copy Markdown
Contributor

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-actionsgithub-actionsBot added physical-expr Changes to the physical-expr crates core Core DataFusion crate labels Jul 19, 2023
@alamb
alambforce-pushed the alamb/less_state branch from a4106d9 to 3a5c8adCompareJuly 19, 2023 10:58
@github-actionsgithub-actionsBot removed the physical-expr Changes to the physical-expr crates label Jul 19, 2023
}

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

Copy link
Copy Markdown
ContributorAuthor

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

@tustvoldtustvold left a comment

Copy link
Copy Markdown
Contributor

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

Comment threaddatafusion/core/src/physical_plan/aggregates/row_hash.rs Outdated
Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com>
@alamb
alamb marked this pull request as ready for review July 19, 2023 21:00
@alamb

Copy link
Copy Markdown
ContributorAuthor

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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coreCore DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@alamb@tustvold