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: Encapsulate return_type and signature in AggregateFunction and WindowFunction #6748

Merged
merged 3 commits into from
Jul 2, 2023

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jun 22, 2023

Reviewing the PR with whitespace blind diff I think makes it easier to see what is going on: #6748

This is a very small logical change, but since it changes the indent level the textual change is significant

Which issue does this PR close?

Follow on to #6612

Rationale for this change

This has been a pet peeve of mine and I think it makes working with this code harder than needed as finding important functionality like "what is the signature of this function" harder because they aren't documented on https://docs.rs/datafusion-expr/26.0.0/datafusion_expr/window_function/enum.WindowFunction.html or https://docs.rs/datafusion-expr/26.0.0/datafusion_expr/aggregate_function/enum.AggregateFunction.html

What changes are included in this PR?

  1. Move signature, return_type to functions on WindowFunction and BuiltInWindowFunction and AggregateFunction
  2. Mark the existing functions as deprecated

Are these changes tested?

existing coverage

Are there any user-facing changes?

Hopefully easier to navigate code

There is no API change as the existing methods still exist, they are just deprecated

@github-actions github-actions bot added the logical-expr Logical plan and expressions label Jun 22, 2023
@alamb alamb force-pushed the alamb/encapsulate_aggregate_functions branch from 5728dae to 9d0c676 Compare June 22, 2023 17:51
@@ -246,10 +276,10 @@ mod tests {
#[test]
fn test_count_return_type() -> Result<()> {
let fun = find_df_window_func("count").unwrap();
let observed = return_type(&fun, &[DataType::Utf8])?;
let observed = fun.return_type(&[DataType::Utf8])?;
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 basically shows the new API -- use a method on the fun rather than have to find a free function

@github-actions github-actions bot added optimizer Optimizer rules physical-expr Physical Expressions labels Jun 22, 2023
@alamb alamb changed the title Minor: Encapsulate return_type and signature in ` Minor: Encapsulate return_type and signature in AggregateFunction and WindowFunction Jun 22, 2023
&self.signature(),
)?;

match self {
Copy link
Contributor Author

@alamb alamb Jun 22, 2023

Choose a reason for hiding this comment

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

This code is now indented one level more -- there are no logical changes

@alamb alamb marked this pull request as ready for review June 22, 2023 17:53
@tustvold tustvold changed the base branch from main to backup-main June 27, 2023 11:12
@tustvold tustvold changed the base branch from backup-main to main June 27, 2023 11:12
@alamb alamb requested a review from jackwener June 29, 2023 17:36
Copy link
Member

@jackwener jackwener left a comment

Choose a reason for hiding this comment

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

Thanks @alamb

@alamb
Copy link
Contributor Author

alamb commented Jul 2, 2023

Thank you for the review @jackwener

@alamb alamb merged commit 4a0b65d into apache:main Jul 2, 2023
@alamb alamb deleted the alamb/encapsulate_aggregate_functions branch July 2, 2023 12:16
2010YOUY01 pushed a commit to 2010YOUY01/arrow-datafusion that referenced this pull request Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions optimizer Optimizer rules physical-expr Physical Expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants