Skip to content

Commit dfd3153

Browse files
committed
Window frame exclusion could be specified only if frame is specified
1 parent 1a6abab commit dfd3153

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

doc/sql.extensions/README.window_functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Syntax:
1414
OVER {<window specification> | <existing window name>}
1515
1616
<window specification> ::=
17-
([<existing window name>] [<window partition>] [<window order>] [<window frame>] [<window frame exclusion>])
17+
([<existing window name>] [<window partition>] [<window order>] [<window frame>])
1818
1919
<window partition> ::=
2020
PARTITION BY <expr> [, <expr> ...]
@@ -23,7 +23,7 @@ Syntax:
2323
ORDER BY <expr> [<direction>] [<nulls placement>] [, <expr> [<direction>] [<nulls placement>]] ...
2424
2525
<window frame> ::=
26-
{RANGE | ROWS} <window frame extent>
26+
{RANGE | ROWS} <window frame extent> [<window frame exclusion>]
2727
2828
<window frame extent> ::=
2929
{<window frame start> | <window frame between>}
@@ -282,7 +282,7 @@ With `ROWS`, order expressions is not limited by number or types. In this case,
282282

283283
The frame syntax with `<window frame start>` specifies the start frame, with the end frame being `CURRENT ROW`.
284284

285-
The optional frame exclusion clause (FB 6.0) removes rows from the frame after its bounds have been evaluated. `EXCLUDE NO OTHERS` is the default and keeps the frame unchanged.
285+
The optional frame exclusion clause (FB 6.0) is part of the frame clause and removes rows from the frame after its bounds have been evaluated. It can only be specified together with an explicit `ROWS` or `RANGE` frame. `EXCLUDE NO OTHERS` is the default and keeps the frame unchanged.
286286

287287
`EXCLUDE CURRENT ROW` removes only the current row from the frame.
288288

src/dsql/parse-conflicts.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
139 shift/reduce conflicts, 7 reduce/reduce conflicts.
1+
137 shift/reduce conflicts, 7 reduce/reduce conflicts.

src/dsql/parse.y

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8977,6 +8977,13 @@ window_clause
89778977
: symbol_window_name_opt
89788978
window_partition_opt
89798979
order_clause_opt
8980+
{
8981+
$$ = newNode<WindowClause>($1, $2, $3,
8982+
static_cast<WindowClause::FrameExtent*>(NULL), WindowClause::Exclusion::NO_OTHERS);
8983+
}
8984+
| symbol_window_name_opt
8985+
window_partition_opt
8986+
order_clause_opt
89808987
window_frame_extent
89818988
window_frame_exclusion_opt
89828989
{
@@ -8992,9 +8999,7 @@ window_partition_opt
89928999

89939000
%type <windowClauseFrameExtent> window_frame_extent
89949001
window_frame_extent
8995-
: /* nothing */
8996-
{ $$ = NULL; }
8997-
| RANGE
9002+
: RANGE
89989003
{ $$ = newNode<WindowClause::FrameExtent>(WindowClause::FrameExtent::Unit::RANGE); }
89999004
window_frame($2)
90009005
{ $$ = $2; }

0 commit comments

Comments
 (0)