classWindowRule
final class WindowRule
Lowers OVER clauses and window specifications.
Rule: PG-WINDOW-LOWERING-001. Scope: over_clause, window_specification, opt_existing_window_name, opt_partition_clause, opt_frame_clause, frame_extent, frame_bound, opt_window_exclusion_clause. Constructors: WindowSpecification, WindowFrame, FrameBound. EXCLUDE NO OTHERS states the default and is noise (see InvocationNoise). The frames the grammar's action rejects (a start at UNBOUNDED FOLLOWING, an end at UNBOUNDED PRECEDING, a frame that ends before it starts) raise an AnalysisException with the server's message. Termination: the partition list is flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS. Status: Implemented.
Methods§
public function over(Node $clause): WindowSpecification|Name|nullLowers over_clause: a specification, a window name, or nothing.
Parameters
$clause | Node |
Returns
WindowSpecification|Name|nullThrows
AnalysisException When the frame is one the actions of `frame_extent` in `gram.y` rejectImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 2
- method-call WindowRule::specification() line 87
- static-call ImplementationGap::production() line 89
public function specification(Node $specification): WindowSpecificationLowers window_specification.
Parameters
$specification | Node |
Returns
Throws
AnalysisException When the frame is one the server rejects while parsingImplementationGap When the production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::window() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:93
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\WindowRule::over() packages/sql-semantics-postgres/src/Lowering/Invocation/WindowRule.php:87
Calls 3
- static-call ImplementationGap::production() line 103
- new WindowSpecification line 118
- method-call WindowRule::frame() line 118
public function frame(Node $clause): ?WindowFrameLowers opt_frame_clause; no clause is null.
Parameters
$clause | Node |
Returns
Throws
AnalysisException When the frame is one the server rejects while parsingImplementationGap When the production has no ruleTest cases 2
Called from 1
Calls 7
- class-const WindowRule::MODES() line 133
- static-call ImplementationGap::production() line 133
- function-call
array_key_existsline 135 - class-const WindowRule::EXCLUSIONS() line 135
- method-call WindowRule::bound() line 140
- method-call WindowRule::check() line 144
- new WindowFrame line 146
public function check(FrameBoundKind $start, ?FrameBoundKind $end): voidRejects the frames the actions of frame_extent in gram.y reject, with the server's messages.
Parameters
$start | FrameBoundKind | |
$end | ?FrameBoundKind |
Throws
AnalysisException When the frame is rejectedTest cases 1
Called from 1
Calls 6
- class-const FrameBoundKind::CurrentRow() line 156
- class-const FrameBoundKind::UnboundedFollowing() line 158
- class-const FrameBoundKind::OffsetFollowing() line 159
- class-const FrameBoundKind::UnboundedPreceding() line 160
- class-const FrameBoundKind::OffsetPreceding() line 161
- new AnalysisException line 166
public function bound(Node $bound): FrameBoundLowers frame_bound.
Parameters
$bound | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\WindowRule::frame() packages/sql-semantics-postgres/src/Lowering/Invocation/WindowRule.php:140
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\WindowRule::frame() packages/sql-semantics-postgres/src/Lowering/Invocation/WindowRule.php:141
Calls 3
- class-const WindowRule::BOUNDS() line 178
- static-call ImplementationGap::production() line 178
- new FrameBound line 180
Private surface 4§
Implementation details, listed for orientation only.
private const BOUNDS = ['frame_bound: UNBOUNDED PRECEDING' => \SqlSemantics\Platform\PostgreSql\Statem…private const EXCLUSIONS = ['opt_window_exclusion_clause:' => null, 'opt_window_exclusion_clause: EXCLUDE …private const MODES = ['opt_frame_clause: RANGE frame_extent opt_window_exclusion_clause' => \SqlSema…private Lowering $loweringTest cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
WindowRuleTest::testBoundLowersAnOffsetcallsWindowRuleTest::testCheckRejectsAStartAfterTheCurrentRowAlonecallsWindowRuleTest::testFrameLowersNoFrameToNullcallsWindowRuleTest::testFrameRejectsAFrameEndingBeforeItStartscallsWindowRuleTest::testOverLowersNoClauseToNullcallsWindowRuleTest::testSpecificationLowersEveryPartcalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::window() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:93
- new SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::over() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:103
Method calls 2
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::window() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:93
- method-call SqlSemantics\Platform\PostgreSql\Lowering\Invocation\Invocations::over() packages/sql-semantics-postgres/src/Lowering/Invocation/Invocations.php:103