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

Disallow window framing clause for certain window functions #23856

Merged

Conversation

piotrrzysko
Copy link
Member

Description

Issue #23742 describes unexpected behavior of the lag function when used with a window framing clause. It turns out that the problem does not exist in the current version of Trino. This PR adds a test to confirm this. Additionally, it adds a check to verify that the window framing clause is not used with the ntile, rank, dense_rank, percent_rank, cume_dist, and row_number functions, which aligns with the SQL specification.

Additional context and related issues

Fixes #23742

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

## General
* Disallow the window framing clause for {func}`ntile`, {func}`rank`, {func}`dense_rank`, {func}`percent_rank`,  {func}`cume_dist`, and {func}`row_number`. ({issue}`23742`)

According to the SQL specification:

If <ntile function>, <lead or lag function>, <rank function type> or
ROW_NUMBER is specified, then:
    ...
    b) The window framing clause of WDX shall not be present.
@cla-bot cla-bot bot added the cla-signed label Oct 21, 2024
@github-actions github-actions bot added the docs label Oct 21, 2024
@martint martint merged commit f8996c4 into trinodb:master Oct 21, 2024
96 checks passed
@github-actions github-actions bot added this to the 463 milestone Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

range between seems to not support lag()
2 participants