classWindowFrame
final class WindowFrame
implements Clause
uses Snapshot
Public API: explicitly declared with
@visibility public.The frame of a window: its mode, its start, an optional end, and an optional exclusion.
A frame written with a start only ends at the current row. The combinations the grammar rejects cannot be constructed: a frame does not start at UNBOUNDED FOLLOWING or end at UNBOUNDED PRECEDING, a frame that starts at the current row does not end before it, and a frame that starts after the current row does not end at or before it. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS.
$frame = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\WindowFrame(
\SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameMode::Rows,
new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameBound(\SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameBoundKind::UnboundedPreceding),
);
[$frame->mode->value, $frame->end] // => ['ROWS', null]new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\WindowFrame(
\SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameMode::Rows,
new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameBound(\SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameBoundKind::UnboundedFollowing),
) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public FrameMode $modepublic FrameBound $startpublic FrameBound|null $end = nullpublic FrameExclusion|null $exclusion = nullMethods§
public function __construct(
public FrameMode $mode,
public FrameBound $start,
public FrameBound|null $end = null,
public FrameExclusion|null $exclusion = null,
)Parameters
$mode | FrameMode | How the bounds are measured |
$start | FrameBound | Where the frame starts |
$end | FrameBound|null | Where the frame ends; null when only a start is written |
$exclusion | FrameExclusion|null | The rows left out around the current row |
Calls 6
- class-const FrameBoundKind::CurrentRow() line 53
- static-call Check::input() line 54
- class-const FrameBoundKind::UnboundedFollowing() line 54
- class-const FrameBoundKind::UnboundedPreceding() line 55
- class-const FrameBoundKind::OffsetPreceding() line 56
- class-const FrameBoundKind::OffsetFollowing() line 57
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives the offset expressions of the bounds.
Parameters
$derivation | Derivation | |
$environment | Environment |
Test cases 1
Calls 1
- method-call FrameBound::deriveClause() line 65
public function render(Output $out): voidWrites the mode, the bounds and the exclusion.
Parameters
$out | Output |
Test cases 2
Calls 3
- method-call Output::keyword() line 74
- method-call Output::node() line 76
- function-call
explodeline 81
Test cases 11§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
WindowFrameTest::testDeriveClauseDerivesTheOffsetsOfBothBoundscallsWindowFrameTest::testRejectsAnEndAtUnboundedPrecedingcallsWindowFrameTest::testRejectsAStartAfterTheCurrentRowWithoutAnEndcallsWindowFrameTest::testRenderWritesAStartAlonecallsWindowFrameTest::testRenderWritesBetweenForTwoBoundscalls
Other tests reaching this symbol 6
WindowChecksTest::testSpecificationLeavesARefinedWindowToTheWindowClausecallsWindowChecksTest::testSpecificationReportsARangeOffsetWithoutASingleOrderingcallsWindowChecksTest::testSpecificationReportsGroupsWithoutOrderingcallsWindowSpecificationTest::testDeriveClauseDerivesPartitionOrderAndFramecallsWindowSpecificationTest::testDeriveClauseReportsAFrameTheOrderingCannotSupportcallsWindowSpecificationTest::testRenderWritesTheSpecificationInParenthesescalls
Relations§
Instantiated in 1
Type declarations 2
- type SqlSemantics\Platform\PostgreSql\Lowering\Invocation\WindowRule packages/sql-semantics-postgres/src/Lowering/Invocation/WindowRule.php:127
- type SqlSemantics\Platform\PostgreSql\Statement\Invocation\WindowSpecification packages/sql-semantics-postgres/src/Statement/Invocation/WindowSpecification.php:56