classWindowSpec
final class WindowSpec
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.A window specification: an optional base window, a partition, an ordering and a frame.
Source: https://sqlite.org/windowfunctions.html#window_chaining.
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT rank() OVER (w PARTITION BY a ORDER BY b) FROM t WINDOW w AS ()');
$window = $query->statement->columns[0]->expression->over;
[$window->base->value, count($window->partition), count($window->order)] // => ['w', 1, 1]Properties§
public list<Scalar> $partitionpublic list<SortTerm> $orderpublic Name|null $base = nullpublic Frame|null $frame = nullMethods§
public function __construct(
public Name|null $base = null,
list<Scalar> $partition = [],
list<SortTerm> $order = [],
public Frame|null $frame = null,
)Parameters
Calls 3
- static-call Check::listOf() line 49
- class-const Scalar::class() line 49
- class-const SortTerm::class() line 50
public function expressions(): list<Scalar>Answers every expression of the window in written order.
Returns
list<Scalar>Test cases 1
public function render(Output $out): voidWrites the specification without its parentheses.
Parameters
$out | Output |
Calls 4
- method-call Output::name() line 79
- class-const NameUse::Label() line 79
- method-call Output::keyword() line 82
- method-call Output::node() line 87
Test cases 20§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
Other tests reaching this symbol 16
CallRuleTest::testFilterOverLowersAFilterOnlyAWindowOnlyAndBothcallsCallRuleTest::testOverLowersAWindowSpecificationOrAWindowNamecallsWindowRuleTest::testBoundLowersEveryBoundaryKindWithItsOffsetcallsWindowRuleTest::testExclusionLowersEachExclusionAndNullWithoutItcallsWindowRuleTest::testFrameLowersAStartOnlyFrameAndABetweenFrameOfEveryUnitcallsWindowRuleTest::testWindowLowersEachOfTheSixSpecificationFormscallsSortRuleTest::testTermsTreatsAnIntegerAsAResultColumnPositionOnlyInTheOrderByOfAQuerycallsFunctionCallTest::testRenderWritesANewlyBuiltCallcallsFrameBoundKindTest::testCasesMatchTheBoundariesOfAnAnalyzedFramecallsFrameBoundTest::testReadsTheOffsetOfAnAnalyzedBoundarycallsFrameBoundTest::testRenderWritesANewlyBuiltBoundarycallsFrameExclusionTest::testFromMatchesTheExclusionOfAnAnalyzedFramecallsFrameTest::testReadsBothEndsAndTheExclusioncallsFrameTest::testRenderWritesANewlyBuiltFramecallsFrameUnitTest::testFromMatchesTheUnitOfAnAnalyzedFramecallsWindowDefinitionTest::testRenderWritesANewlyBuiltDefinitioncalls
Relations§
Instantiated in 6
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\WindowRule::window() packages/sql-semantics-sqlite/src/Lowering/Expression/WindowRule.php:53
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\WindowRule::window() packages/sql-semantics-sqlite/src/Lowering/Expression/WindowRule.php:54
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\WindowRule::window() packages/sql-semantics-sqlite/src/Lowering/Expression/WindowRule.php:55
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\WindowRule::window() packages/sql-semantics-sqlite/src/Lowering/Expression/WindowRule.php:56
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\WindowRule::window() packages/sql-semantics-sqlite/src/Lowering/Expression/WindowRule.php:57
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\WindowRule::window() packages/sql-semantics-sqlite/src/Lowering/Expression/WindowRule.php:58
Type checks 1
Type declarations 4
- type SqlSemantics\Platform\Sqlite\Lowering\Expression\CallRule packages/sql-semantics-sqlite/src/Lowering/Expression/CallRule.php:103
- type SqlSemantics\Platform\Sqlite\Lowering\Expression\WindowRule packages/sql-semantics-sqlite/src/Lowering/Expression/WindowRule.php:45
- type SqlSemantics\Platform\Sqlite\Statement\Expression\FunctionCall packages/sql-semantics-sqlite/src/Statement/Expression/FunctionCall.php:77
- type SqlSemantics\Platform\Sqlite\Statement\Expression\Window\WindowDefinition packages/sql-semantics-sqlite/src/Statement/Expression/Window/WindowDefinition.php:31