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 / simplify BuiltInWindowExpr / BuiltInWindowFunctionExpr #13473

Open
alamb opened this issue Nov 18, 2024 · 1 comment
Open

Rename / simplify BuiltInWindowExpr / BuiltInWindowFunctionExpr #13473

alamb opened this issue Nov 18, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Nov 18, 2024

Is your feature request related to a problem or challenge?

However, there are still a few structures named BuiltInWindow* that now no longer reflect the reality that there are no more "built in" functions:

A BuiltInWindowExpr here:

/// A window expr that takes the form of a [`BuiltInWindowFunctionExpr`].
#[derive(Debug)]
pub struct BuiltInWindowExpr {
expr: Arc<dyn BuiltInWindowFunctionExpr>,
partition_by: Vec<Arc<dyn PhysicalExpr>>,
order_by: LexOrdering,
window_frame: Arc<WindowFrame>,
}

A BuiltInWindowFunctionExpr:

/// Evaluates a window function by instantiating a
/// `[PartitionEvaluator]` for calculating the function's output in
/// that partition.
///
/// Note that unlike aggregation based window functions, some window
/// functions such as `rank` ignore the values in the window frame,
/// but others such as `first_value`, `last_value`, and
/// `nth_value` need the value.
#[allow(rustdoc::private_intra_doc_links)]
pub trait BuiltInWindowFunctionExpr: Send + Sync + std::fmt::Debug {

Which confusingly is implemented for WindowUDFExpr:

impl BuiltInWindowFunctionExpr for WindowUDFExpr {
fn as_any(&self) -> &dyn std::any::Any {
self
}

Describe the solution you'd like

  1. I would like to rename the confusing BuiltIn prefix for these structures
  2. Leave backwards compatibility typedefs type BuiltInWindowExpr = ... to ease migration

Describe alternatives you've considered

I would recommend first simply renaming the structs / traits to remove the BuiltIn prefix / module names

Then I also think it is worth seeing if the BuiltInWindowFunctionExpr trait is still needed, or if the code in physical plan could simply call WindowUDF directly

Additional context

No response

@alamb alamb added the enhancement New feature or request label Nov 18, 2024
@alamb alamb changed the title Remove / simplify BuiltInWindowExpr Rename / simplify BuiltInWindowExpr / BuiltInWindowFunctionExpr Nov 18, 2024
@alamb alamb added the good first issue Good for newcomers label Nov 18, 2024
@irenjj
Copy link
Contributor

irenjj commented Nov 19, 2024

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants