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

Rename expr::window_function::WindowFunction to WindowFunctionDefinition, make structure consistent with ScalarFunction #8382

Merged
merged 3 commits into from
Jan 1, 2024

Conversation

edmondop
Copy link
Contributor

@edmondop edmondop commented Nov 30, 2023

Which issue does this PR close?

Closes #8347

Rationale for this change

The idea is to have the ScalarFunctions and WindowFunctions consistent in structure with each other

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added sql SQL Planner logical-expr Logical plan and expressions optimizer Optimizer rules core Core DataFusion crate labels Nov 30, 2023
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @edmondop -- this is looking like a nice step in the right direction

datafusion/expr/src/window_function.rs Outdated Show resolved Hide resolved
///
/// [window function]: https://en.wikipedia.org/wiki/Window_function_(SQL)
#[derive(Debug, Clone, PartialEq, Eq, Hash, EnumIter)]
pub enum BuiltInWindowFunction {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you could put BuiltInWindowFunction in datafusion/expr/src/built_in_window_function.rs to mirror BuiltInFunction?
https://github.com/apache/arrow-datafusion/blob/main/datafusion/expr/src/built_in_function.rs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alamb @haohuaijin have I understood correctly?

  • BuiltinWindowFunction goes into datafusion/expr/src/built_in_window_function.rs
  • WindowFunction becomes WindowFunctionDefinition and goes into datafusion/expr/src/expr.rs with its trait implementations
  • public functions in window_function stays there

Copy link
Contributor

Choose a reason for hiding this comment

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

  • BuiltinWindowFunction goes into datafusion/expr/src/built_in_window_function.rs
  • WindowFunction becomes WindowFunctionDefinition and goes into datafusion/expr/src/expr.rs with its trait implementations

yes, you are correct.

  • public functions in window_function stays there

maybe those public functions also can move to datafusion/expr/src/built_in_window_function.rs. cc @alamb

@alamb alamb marked this pull request as draft December 12, 2023 22:13
@alamb
Copy link
Contributor

alamb commented Dec 12, 2023

This PR looks like it needs some work so marking it as a draft until it is ready for review again

@edmondop edmondop marked this pull request as ready for review December 23, 2023 01:47
@edmondop edmondop requested a review from alamb December 23, 2023 01:53
@alamb alamb changed the title Rename expr::window_function::WindowFunction to WindowFunctionDefinition for consistency Rename expr::window_function::WindowFunction to WindowFunctionDefinition, make structure consistent with ScalarFunction Dec 23, 2023
@alamb alamb added the api change Changes the API exposed to users of the crate label Dec 23, 2023
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @edmondop -- I think this is great

I think it is excellent that the structure of the window functions now mirrors the structure of the scalar functions -- it will make navigating the datafusion codebase much easier

@@ -0,0 +1,207 @@
// Licensed to the Apache Software Foundation (ASF) under one
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@alamb alamb merged commit d2b3d1c into apache:main Jan 1, 2024
22 checks passed
@alamb
Copy link
Contributor

alamb commented Jan 1, 2024

Thanks again @edmondop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules sql SQL Planner substrait
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename expr::window_function::WindowFunction to WindowFunctionDefintion for consistency
3 participants