Skip to content

Conversation

@toppyy
Copy link
Contributor

@toppyy toppyy commented May 21, 2023

Which issue does this PR close?

Closes #6338.

Rationale for this change

List window functions in the user guide

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@alamb alamb mentioned this pull request May 22, 2023

# Window Functions

Window functions calculate a value for a set of rows within a result set.
Copy link
Contributor

Choose a reason for hiding this comment

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

We can probably copy some/all of the description from the postgres docs rather than having to reinvent it: https://www.postgresql.org/docs/current/tutorial-window.html

Copy link
Contributor Author

@toppyy toppyy May 24, 2023

Choose a reason for hiding this comment

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

Thanks for the feedback! I stitched together a description of window functions from the postgres docs and added a sub-section describing the syntax.

(EDIT: Just noticed that named windows are now supported, I'll add those the syntax description next) Named window functions are described also.

@toppyy toppyy marked this pull request as ready for review May 28, 2023 06:44
@alamb alamb added documentation Improvements or additions to documentation datafusion labels May 29, 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.

This looks great -- thank you so much @toppyy

```sql
SELECT sum(salary) OVER w, avg(salary) OVER w
FROM empsalary
WINDOW w AS (PARTITION BY depname ORDER BY salary DESC);
Copy link
Contributor

Choose a reason for hiding this comment

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

This feature (named window functions) was added just a few days ago by @berkaysynnada #6419 🎉

@alamb alamb merged commit c768c9b into apache:main May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document Window functions

3 participants