-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
37251: sql: fix semantic analysis and type checking of window functions r=yuzefovich a=yuzefovich Previously, performing semantic analysis and type checking of related to window functions expressions was performed as a part of analysis of FuncExpr. However, this is not sufficient in all cases: for example, on the query like SELECT rank() OVER (w RANGE 1 PRECEDING) FROM t WINDOW w AS (ORDER BY a), in order to correctly analyze 1, we need to have information about ORDER BY clause coming from window definition w. This information is only available after we constructed window definitions in window.go. Additionally, this commit now requires an ORDER BY clause with GROUPS mode of framing (which is exactly what PostgreSQL does). Actually, without the ordering clause, GROUPS mode doesn't make sense since all rows will be a part of the same peer group which probably indicates a user error, so we will return an error in such cases. Release note: None Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
- Loading branch information
Showing
9 changed files
with
354 additions
and
240 deletions.
There are no files selected for viewing
This file contains 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
Oops, something went wrong.