Skip to content

Document Window functions #6338

Closed
Closed

Description

@alamb

Is your feature request related to a problem or challenge?

@mustafasrepo and others have contributed to a sophisticated window function implementation in DataFusion like

select x, lag(x, 1) OVER (partition by y, order by x) FROM foo

However, the user guide does not appear to mention this

Describe the solution you'd like

  1. Note in the user guide that DataFusion supports window functions
  2. Add a new page for WindowFunctions (similar to the aggregate function list)

Note the docs (and instructions) are in https://github.com/apache/arrow-datafusion/tree/main/docs

The list of window functions is

  1. aggregate functions
  2. The list here https://docs.rs/datafusion-expr/24.0.0/datafusion_expr/window_function/enum.BuiltInWindowFunction.html

Describe alternatives you've considered

No response

Additional context

No response

Activity

  1. toppyy commented on May 20, 2023

    @toppyy
    Contributor

    started work on this!

  2. toppyy commented on May 21, 2023

    @toppyy
    Contributor

    Made a draft PR.

    The issue states that the PR should "Note in the user guide that DataFusion supports window functions". Any ideas where exactly to mention this? I had a look and I didn't find a place that felt suitable.

    Also, I was on the fence about whether to describe the over-clause with each function as it seems repetative. The alternative would be to described the syntax for window functions on top of the page once in a general form (ie. something like function(expr) over([partition by expr2] [order by expr3 [ asc | desc ][, …]])). Any thoughts?

  3. alamb commented on May 22, 2023

    @alamb
    ContributorAuthor

    Thanks @toppyy !

    The issue states that the PR should "Note in the user guide that DataFusion supports window functions". Any ideas where exactly to mention this? I had a look and I didn't find a place that felt suitable.

    Perhaps we can add a new Window Functions page, following the model of Aggregate Functions? (UPDATE: I see this is exactly what you did in #6402 🤦 sorry for not checking that first)

    Screenshot 2023-05-22 at 4 42 29 PM

    Also, I was on the fence about whether to describe the over-clause with each function as it seems repetative. The alternative would be to described the syntax for window functions on top of the page once in a general form (ie. something like function(expr) over([partition by expr2] [order by expr3 [ asc | desc ][, …]])). Any thoughts?

    I think describing the OVER clause once in general rather than for each function makes much more sense.

    Perhaps we can take inspiration (and/or some of the text) from the postgres description: https://www.postgresql.org/docs/current/tutorial-window.html

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or requestgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions