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
$columns
public
array<int, SortColumn>
$columns
$config
public
MemorySortConfig|ExternalSortConfig
$config
$fallback
public
ExternalSort|null
$fallback
$limit
public
int
$limit
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
bind()
public
bind(Schema $input) : BoundStep<string|int, Processor>
Parameters
- $input : Schema
Return values
BoundStep<string|int, Processor>breaks()
True when process() needs every input row before it emits one: the processor ends its pipeline.
public
breaks() : bool
Return values
booldescribe()
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|nullfromDescription()
public
static fromDescription(array<string|int, mixed> $data, Rebuild $rebuild) : static
Parameters
- $data : array<string|int, mixed>
- $rebuild : Rebuild
Tags
Return values
staticprocess()
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>top()
public
top(Rows $rows, Backend $backend) : Rows