Repository navigation
Support Oracle KEEP (DENSE_RANK ... FIRST/LAST ... ) syntax - #7950
Merged
Merged
Conversation
keraion
approved these changes
Jun 14, 2026
keraion
left a comment
Contributor
There was a problem hiding this comment.
Nice work. Thanks for the contribution!
Contributor
Coverage Results ✅ |
3 tasks done
1 task
benfdking
added a commit
to quarylabs/sqruff
that referenced
this pull request
Oct 5, 2026
Parse KEEP (DENSE_RANK FIRST/LAST ORDER BY ...) after Oracle aggregate functions, including the OVER form. Add DENSE_RANK keyword, semantic classification, and upstream parser fixture. Upstream SHA: 1bdffedcc46d6ca97b1be53f960dfcd4618d4693 Upstream PR: sqlfluff/sqlfluff#7950 Upstream commit: sqlfluff/sqlfluff@1bdffed
benfdking
added a commit
to quarylabs/sqruff
that referenced
this pull request
Oct 5, 2026
Parse KEEP (DENSE_RANK FIRST/LAST ORDER BY ...) after Oracle aggregate functions, including the OVER form. Add DENSE_RANK keyword, semantic classification, and upstream parser fixture. Upstream SHA: 1bdffedcc46d6ca97b1be53f960dfcd4618d4693 Upstream PR: sqlfluff/sqlfluff#7950 Upstream commit: sqlfluff/sqlfluff@1bdffed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief summary of the change made
Fixes #7947
Oracle has a unique syntax surrounding the use of the analytic functions FIRST and LAST.
This PR provides support for the syntax, as described by the oracle documentation.
Are there any other side effects of this change that we should be aware of?
There should not be any.
This only adds a new possible clause behind functions, analogous to already supported
WITHIN GROUPorFILTER (...).I did read up on any relevant documentation pertaining to contributing, but I may have missed some things. If anything in this PR does not meet standard please let me know as this is a first !
Pull Request checklist
Please confirm you have completed any of the necessary steps below.
Included test cases to demonstrate any code changes, which may be one or more of the following:
.ymlrule test cases intest/fixtures/rules/std_rule_cases..sql/.ymlparser test cases intest/fixtures/dialects(note YML files can be auto generated withtox -e generate-fixture-yml).test/fixtures/linter/autofix.AI use disclosure
Agentic AI was used for discovery of the project and a first draft of the changes. These proposed changes were all manually checked. The queries were hand-written from the oracle documentation, then tested.
Summary by cubic
Adds Oracle KEEP (DENSE_RANK FIRST/LAST ORDER BY ...) parsing to the Oracle dialect so aggregate/window functions can use KEEP correctly. Fixes #7947.
Written for commit f38aa2f. Summary will update on new commits.