Skip to content

Rename / simplify BuiltInWindowExpr / BuiltInWindowFunctionExpr #13473

Closed

Description

@alamb

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

Activity

  1. changed the title [-]Remove / simplify `BuiltInWindowExpr`[/-] [+]Rename / simplify `BuiltInWindowExpr` / `BuiltInWindowFunctionExpr`[/+] on Nov 18, 2024
  2. irenjj commented on Nov 19, 2024

    @irenjj
    Contributor

    take

  3. alamb commented on Dec 21, 2024

    @alamb
    ContributorAuthor

    Thanks to @irenjj I think this one is more or less done, so closing the ticket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions