classWindowFunction
final class WindowFunction
implements Scalar
uses Snapshot
@visibility public.A call of a function that is only a window function: ranking, distribution, and the value functions LEAD, LAG, FIRST_VALUE, LAST_VALUE and NTH_VALUE.
Rule: MYSQL-WINDOW-FUNCTION-001. The window is required. The count of NTILE and the offset of LEAD and LAG are an integer, a parameter marker, a user variable or a routine variable (stable_integer); the row number of NTH_VALUE is a primary expression. The result follows MYSQL-WINDOW-RESULT-001. Terminates: the arguments and the window are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/window-function-descriptions.html. Status: Implemented.
(new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT RANK() OVER w') // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\SemanticException: Window name is not definednew \SqlSemantics\Platform\MySql\Statement\Call\Window\WindowFunction(\SqlSemantics\Platform\MySql\Statement\Call\Window\WindowFunctionKind::Tile, [new \SqlSemantics\Platform\MySql\Statement\Literal\NullLiteral()], new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('w')) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstructionProperties§
public list<Scalar> $argumentspublic WindowFunctionKind $kindpublic Name|WindowSpecification $overpublic NullTreatment|null $nulls = nullpublic CountingEdge|null $edge = nullMethods§
public function __construct(
public WindowFunctionKind $kind,
list<Scalar> $arguments,
public Name|WindowSpecification $over,
public NullTreatment|null $nulls = null,
public CountingEdge|null $edge = null,
)Parameters
$kind | WindowFunctionKind | The function |
$arguments | list<Scalar> | The arguments in order |
$over | Name|WindowSpecification | The window written after OVER |
$nulls | NullTreatment|null | The written RESPECT NULLS or IGNORE NULLS |
$edge | CountingEdge|null | The written FROM FIRST or FROM LAST of NTH_VALUE |
Calls 11
- static-call Check::listOf() line 65
- class-const Scalar::class() line 65
- method-call WindowFunctionKind::arity() line 66
- static-call Check::input() line 67
- function-call
countline 67 - method-call WindowFunctionKind::treatsNulls() line 68
- class-const WindowFunctionKind::NthValue() line 69
- method-call WindowFunctionKind::counted() line 70
- method-call Precedence::admits() line 72
- new Precedence line 72
- class-const Precedence::SIMPLE_EXPR() line 72
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the arguments, the window and the result.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 6
- method-call Arguments::one() line 82
- new Arguments line 82
- method-call Windows::derive() line 84
- new Windows line 84
- method-call WindowResults::result() line 86
- new WindowResults line 86
public function render(Output $out): voidWrites the call, its options and its window.
Parameters
$out | Output |
Test cases 1
Calls 4
- method-call Output::keyword() line 94
- function-call
explodeline 96 - method-call Windows::render() line 101
- new Windows line 101
Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.