apache / apache/datafusion-sqlparser-rs

Support defining windowing behavior in the WINDOW clause

Open
#760 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
3.5k
Forks
772
Avg merge
4d 9h
Merged PRs (30d)
17

Description

PostgreSQL and SparkSQL support defining the windowing behavior in the WINDOW clause and then referenced in OVER.
This is very useful if the same windowing behavior is wanted for several functions.

For example:

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

````

https://www.postgresql.org/docs/15/tutorial-window.html

https://www.postgresql.org/docs/15/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the parser handles WINDOW and OVER syntax, using the PostgreSQL examples in the issue as the grammar reference. Define the required parsing behavior for named window definitions and references, then add coverage proving both functions can reuse w and that the example parses.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.