classWindowSpec
final class WindowSpec
implements WindowSpecification
uses Snapshot
@visibility public.A parenthesized window specification: an optional window it refines, a partitioning, an ordering and a frame.
Rule: MYSQL-WINDOW-SPEC-001. The expressions are derived at the position of the window. The base window is a window of the WINDOW clause, which the query family resolves. A GROUPS frame and an EXCLUDE clause are accepted by the grammar and rejected by the server (ER_NOT_SUPPORTED_YET). Terminates: the parts are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/window-functions-usage.html, https://dev.mysql.com/doc/refman/8.4/en/window-functions-named-windows.html. Status: Implemented.
$order = [new \SqlSemantics\Platform\MySql\Statement\Query\OrderItem(new \SqlSemantics\Platform\MySql\Statement\Name\ColumnUse(new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('b')))];
$window = new \SqlSemantics\Platform\MySql\Statement\Call\Window\WindowSpec(null, [], $order, new \SqlSemantics\Platform\MySql\Statement\Call\Window\Frame(\SqlSemantics\Platform\MySql\Statement\Call\Window\FrameUnit::Rows, new \SqlSemantics\Platform\MySql\Statement\Call\Window\FrameBound(\SqlSemantics\Platform\MySql\Statement\Call\Window\FrameBoundKind::UnboundedPreceding)));
[count($window->partition), count($window->order), $window->frame?->unit] // => [0, 1, \SqlSemantics\Platform\MySql\Statement\Call\Window\FrameUnit::Rows]Properties§
public list<OrderItem> $partitionpublic list<OrderItem> $orderpublic Name|null $base = nullpublic Frame|null $frame = nullMethods§
public function __construct(
public Name|null $base = null,
list<OrderItem> $partition = [],
list<OrderItem> $order = [],
public Frame|null $frame = null,
)Parameters
Calls 2
- static-call Check::listOf() line 60
- class-const OrderItem::class() line 60
public function deriveWindow(Derivation $derivation, Environment $environment): voidDerives the partitioning, the ordering and the frame offsets, and reports what the server does not support.
Parameters
$derivation | Derivation | |
$environment | Environment |
Test cases 2
Calls 7
- method-call Arguments::one() line 70
- new Arguments line 70
- class-const FrameUnit::Groups() line 75
- method-call Derivation::report() line 76
- new UnsupportedWindowing line 76
- class-const WindowingLimit::GroupsUnit() line 76
- class-const WindowingLimit::Exclusion() line 79
public function render(Output $out): voidWrites the parenthesized specification.
Parameters
$out | Output |
Test cases 1
Calls 5
- method-call Output::symbol() line 88
- method-call Output::name() line 90
- class-const NameUse::Label() line 90
- method-call Output::keyword() line 93
- method-call Output::node() line 98
Test cases 10§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 8
CallRulesTest::testWindowSpecificationLowersASpecificationcallsWindowRuleTest::testWindowLowersASpecificationcallsWindowsTest::testDeriveDerivesTheExpressionsOfASpecificationcallsWindowsTest::testRenderWritesTheWindowAfterOvercallsAggregateTest::testAggregatesTellsWhetherTheCallHasNoWindowcallsAggregateTest::testDeriveScalarDerivesTheWindowcallsWindowFunctionTest::testDeriveScalarDerivesTheArgumentsAndTheWindowcallsWindowSpecificationTest::testDeriveWindowDerivesTheExpressionscalls