classWindowRule
final class WindowRule
Lowers the window functions and the window written after OVER.
Rule: MYSQL-CALL-WINDOW-001. Scope: window_func_call, opt_lead_lag_info, opt_ll_default, stable_integer, param_or_var, opt_null_treatment, opt_from_first_last, opt_windowing_clause, windowing_clause, window_name_or_spec, window_name. The count of NTILE and the offset of LEAD and LAG are an integer, a parameter marker, a routine variable or a user variable. RESPECT NULLS, IGNORE NULLS, FROM FIRST and FROM LAST are kept as written. Constructs: WindowFunction, RoutineVariable. Terminates: every child is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/window-function-descriptions.html, https://dev.mysql.com/doc/refman/8.4/en/window-functions-usage.html. Status: Implemented.
Methods§
public function function(Node $call): WindowFunctionLowers a window function: a node of window_func_call.
Parameters
$call | Node |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 2
Called from 1
Calls 10
- method-call Lowering::form() line 80
- class-const WindowRule::FUNCTIONS() line 81
- static-call ImplementationGap::production() line 81
- method-call WindowRule::stable() line 87
- function-call
array_pushline 90 - method-call WindowRule::offset() line 90
- new WindowFunction line 96
- method-call WindowRule::window() line 99
- method-call WindowRule::nulls() line 100
- method-call WindowRule::edge() line 101
public function offset(Node $options): list<Scalar>Lowers the offset and default of LEAD and LAG: a node of opt_lead_lag_info.
Parameters
$options | Node |
Returns
list<Scalar>Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 1
Calls 3
- method-call Lowering::form() line 113
- static-call ImplementationGap::production() line 118
- method-call WindowRule::stable() line 120
Lowers a count or offset: a node of stable_integer.
Parameters
$integer | Node |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 2
Calls 3
- method-call Lowering::form() line 137
- static-call ImplementationGap::production() line 142
- new RoutineVariable line 148
public function nulls(Node $treatment): ?NullTreatmentLowers the NULL treatment: a node of opt_null_treatment.
Parameters
$treatment | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 4
- method-call Lowering::form() line 161
- function-call
array_key_existsline 162 - class-const WindowRule::NULLS() line 162
- static-call ImplementationGap::production() line 163
public function edge(Node $edge): ?CountingEdgeLowers the edge of NTH_VALUE: a node of opt_from_first_last.
Parameters
$edge | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 1
Calls 4
- method-call Lowering::form() line 176
- function-call
array_key_existsline 177 - class-const WindowRule::EDGES() line 177
- static-call ImplementationGap::production() line 178
public function windowing(Node $clause): Name|WindowSpecification|nullLowers an optional window: a node of opt_windowing_clause.
Parameters
$clause | Node |
Returns
Name|WindowSpecification|nullThrows
ImplementationGap When a production has no ruleTest cases 1
Called from 3
- method-call SqlSemantics\Platform\MySql\Lowering\Call\AggregateRule::aggregate() packages/sql-semantics-mysql/src/Lowering/Call/AggregateRule.php:123
- method-call SqlSemantics\Platform\MySql\Lowering\Call\AggregateRule::aggregate() packages/sql-semantics-mysql/src/Lowering/Call/AggregateRule.php:132
- method-call SqlSemantics\Platform\MySql\Lowering\Call\AggregateRule::concatenation() packages/sql-semantics-mysql/src/Lowering/Call/AggregateRule.php:145
Calls 3
- method-call Lowering::form() line 191
- method-call WindowRule::window() line 195
- static-call ImplementationGap::production() line 196
public function window(Node $clause): Name|WindowSpecificationLowers the window after OVER: a node of windowing_clause.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 2
Calls 4
- method-call Lowering::form() line 207
- static-call ImplementationGap::production() line 209
- method-call WindowRule::name() line 214
- method-call FrameRule::specification() line 215
Lowers a window name: a node of window_name.
Parameters
$name | Node |
Returns
Throws
ImplementationGap When the production has no ruleTest cases 1
Called from 2
Calls 2
- method-call Lowering::form() line 227
- static-call ImplementationGap::production() line 229
Private surface 5§
Implementation details, listed for orientation only.
private const FUNCTIONS = ['window_func_call: ROW_NUMBER_SYM ( ) windowing_clause' => [\SqlSemantics\Plat…private const NULLS = ['opt_null_treatment:' => null, 'opt_null_treatment: RESPECT_SYM NULLS_SYM' => …private const EDGES = ['opt_from_first_last:' => null, 'opt_from_first_last: FROM FIRST_SYM' => \SqlS…private Lowering $loweringprivate FrameRule $framesTest cases 17§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 9
WindowRuleTest::testEdgeLowersFromFirstcallsWindowRuleTest::testFunctionLowersTheValueFunctionscallsWindowRuleTest::testFunctionReportsAnotherNodecallsWindowRuleTest::testNameLowersAWindowNamecallsWindowRuleTest::testNullsLowersNoTreatmentcallsWindowRuleTest::testOffsetLowersTheOffsetAndTheDefaultcallsWindowRuleTest::testStableLowersEachFormcallsWindowRuleTest::testWindowingLowersNoWindowcallsWindowRuleTest::testWindowLowersASpecificationcalls
Other tests reaching this symbol 8
AggregateRuleTest::testAggregateLowersEveryArgumentFormcallsAggregateRuleTest::testAggregateReportsAnotherNodecallsAggregateRuleTest::testConcatenationLowersGroupConcatcallsAggregateRuleTest::testDistinctTellsWhetherDistinctIsWrittencallsAggregateRuleTest::testOperandLowersAllcallsAggregateRuleTest::testOrderingLowersNoOrderingcallsAggregateRuleTest::testSeparatorLowersNoSeparatorcallsAggregateRuleTest::testSingleLowersOneOperandAsAListcalls
Relations§
Instantiated in 1
Method calls 5
- method-call SqlSemantics\Platform\MySql\Lowering\Call\AggregateRule::aggregate() packages/sql-semantics-mysql/src/Lowering/Call/AggregateRule.php:123
- method-call SqlSemantics\Platform\MySql\Lowering\Call\AggregateRule::aggregate() packages/sql-semantics-mysql/src/Lowering/Call/AggregateRule.php:132
- method-call SqlSemantics\Platform\MySql\Lowering\Call\AggregateRule::concatenation() packages/sql-semantics-mysql/src/Lowering/Call/AggregateRule.php:145
- method-call SqlSemantics\Platform\MySql\Lowering\Call\CallRules::call() packages/sql-semantics-mysql/src/Lowering/Call/CallRules.php:67
- method-call SqlSemantics\Platform\MySql\Lowering\Call\CallRules::windowName() packages/sql-semantics-mysql/src/Lowering/Call/CallRules.php:117