Flow PHP

Average implements AggregatesNumericTotal, FrameAccumulating, WindowFunction

FinalYes

Interfaces

AggregatesNumericTotal
FrameAccumulating
Asserts the result depends only on frame contents, never on the current row or index.
WindowFunction

Methods

__construct()  : mixed
accumulator()  : self
A fresh instance with no window, fed the frame's rows through aggregate().
aggregate()  : void
children()  : array<int, FunctionTree>
Every operand of this node that is an expression, in constructor order.
describe()  : null|Description
deterministic()  : bool
True when this node and every node in children() produce the same value for the same input row.
exact()  : bool
fromDescription()  : static
groupValues()  : Column
merge()  : void
Folds a partial() of another instance into this one; that instance aggregated rows that come after this one's (merge()'s contract).
outputName()  : string
Decided in the constructor, never mutated.
over()  : static
Returns a copy bound to $window. Never mutates $this.
partial()  : array<string, mixed>
This aggregator's state as plain values of partialType(); an aggregator that saw no row returns its initial state.
partialType()  : StructureType<string|int, array<string, mixed>>
The structure partial() returns; valid once the aggregator is resolved (Aggregators::resolved()).
references()  : array<int, Reference>
resolved()  : bool
True when this node and every node in children() can answer returns().
returns()  : Type<string|int, mixed>
An OptionalType return declares the produced column nullable; there is no nullable() peer.
toString()  : string
value()  : null|array<string|int, mixed>|bool|float|int|object|string
values()  : array<int, mixed>
One value per row of $partition, which is sorted by the window's ORDER BY.
window()  : Window
withChildren()  : static
A copy of this node with $children in place of children(): same count, same order, same per-element narrowing. Never mutates $this.

Methods

accumulator()

A fresh instance with no window, fed the frame's rows through aggregate().

public accumulator() : self
Return values
self

aggregate()

public aggregate(Rows $rows, array<string|int, mixed> $indices, Backend $backend) : void
Parameters
$rows : Rows
$indices : array<string|int, mixed>

the rows of $rows that belong to this aggregate, ascending

$backend : Backend

children()

Every operand of this node that is an expression, in constructor order.

public children() : array<int, FunctionTree>
Return values
array<int, FunctionTree>

describe()

public describe() : null|Description
Return values
null|Description —

null when this instance cannot cross a process boundary (a live client, a custom collaborator)

deterministic()

True when this node and every node in children() produce the same value for the same input row.

public deterministic() : bool

False for a generator (now(), uuid, a random string): a caller that evaluates the tree once per FILE or per partition instead of once per row must refuse a non-deterministic one.

Return values
bool

exact()

public exact() : bool
Return values
bool

fromDescription()

public static fromDescription(array<string|int, mixed> $data, Rebuild $rebuild) : static
Parameters
$data : array<string|int, mixed>
$rebuild : Rebuild
Return values
static

merge()

Folds a partial() of another instance into this one; that instance aggregated rows that come after this one's (merge()'s contract).

public merge(array<string|int, mixed> $partial, Backend $backend) : void
Parameters
$partial : array<string|int, mixed>
$backend : Backend

outputName()

Decided in the constructor, never mutated.

public outputName() : string
Return values
string

over()

Returns a copy bound to $window. Never mutates $this.

public over(Window $window) : static
Parameters
$window : Window
Return values
static

partial()

This aggregator's state as plain values of partialType(); an aggregator that saw no row returns its initial state.

public partial() : array<string, mixed>
Return values
array<string, mixed>

partialType()

The structure partial() returns; valid once the aggregator is resolved (Aggregators::resolved()).

public partialType() : StructureType<string|int, array<string, mixed>>
Return values
StructureType<string|int, array<string, mixed>>

resolved()

True when this node and every node in children() can answer returns().

public resolved() : bool
Return values
bool

returns()

An OptionalType return declares the produced column nullable; there is no nullable() peer.

public returns() : Type<string|int, mixed>
Return values
Type<string|int, mixed>

toString()

public toString() : string
Return values
string

value()

public value() : null|array<string|int, mixed>|bool|float|int|object|string
Return values
null|array<string|int, mixed>|bool|float|int|object|string

values()

One value per row of $partition, which is sorted by the window's ORDER BY.

public values(Rows $partition, Backend $backend) : array<int, mixed>
Parameters
$partition : Rows
$backend : Backend
Return values
array<int, mixed>

withChildren()

A copy of this node with $children in place of children(): same count, same order, same per-element narrowing. Never mutates $this.

public withChildren(array<int, FunctionTree> $children) : static
Parameters
$children : array<int, FunctionTree>
Return values
static
On this page

Search results