Flow PHP

TopNProcessor implements Distributable

Read onlyYes
FinalYes

Holds at most 2×$limit rows plus one batch; ties may order unlike ExternalSort.

Interfaces

Distributable
Unlike a Transformer, receives the whole upstream generator, not one batch.

Properties

$columns  : array<int, SortColumn>
$config  : MemorySortConfig|ExternalSortConfig
$fallback  : ExternalSort|null
$limit  : int

Methods

__construct()  : mixed
bind()  : BoundStep<string|int, Processor>
breaks()  : bool
True when process() needs every input row before it emits one: the processor ends its pipeline.
describe()  : null|Description
null when the random value generator or the sort config does not describe.
distribution()  : Distribution|null
Every split keeps its own top rows; one process keeps the top of those. null when it does not describe.
fromDescription()  : static
process()  : Generator<string|int, Rows>
Process a stream of Rows and return a new stream.
top()  : Rows

Properties

Methods

__construct()

public __construct(array<string|int, mixed> $columns, int $limit, ExternalSortConfig|MemorySortConfig $config, RandomValueGenerator $random[, Schema|null $declared = null ]) : mixed
Parameters
$columns : array<string|int, mixed>
$limit : int
$config : ExternalSortConfig|MemorySortConfig

the effective sort config: the operation's own or the frame's; an external one spills past its memory limit

$random : RandomValueGenerator
$declared : Schema|null = null
Tags
throws
InvalidArgumentException

breaks()

True when process() needs every input row before it emits one: the processor ends its pipeline.

public breaks() : bool
Return values
bool

describe()

null when the random value generator or the sort config does not describe.

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

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

distribution()

Every split keeps its own top rows; one process keeps the top of those. null when it does not describe.

public distribution() : Distribution|null
Return values
Distribution|null

process()

Process a stream of Rows and return a new stream.

public process(Generator $rows, Backend $backend) : Generator<string|int, Rows>
Parameters
$rows : Generator
$backend : Backend
Return values
Generator<string|int, Rows>
On this page

Search results