Flow PHP

RecordBatch

FinalYes

Methods

__construct()  : mixed
add()  : array<int, CorruptedRecordException|Rows>
flush()  : array<int, CorruptedRecordException|Rows>
Under a declared schema a record with a value that does not cast is a corrupted record, handed up and left out of the rows; under an inferred schema it is a schema error.
inferred()  : self
of()  : Generator<int, CorruptedRecordException|Rows>
$records added in order, numbered from 1, then flushed.
refuse()  : array<int, CorruptedRecordException|Rows>
A record its reader refused before it became values: it takes its place in the batch, so the batch hands its refused records out in source order.

Methods

__construct()

public __construct(Schema $schema, Backend $backend, int<1, max> $batchSize[, null|string $uri = null ][, null|Schema $known = null ]) : mixed
Parameters
$schema : Schema
$backend : Backend
$batchSize : int<1, max>
$uri : null|string = null

the file the records come from; null for a source that is not a file

$known : null|Schema = null

a keyed reader's (JSON, array, sequence) full schema, $schema's columns and those it leaves out; under an inferred schema a key it lacks was first seen past the sample. A grid reader passes none: its header is checked once per file

add()

public add(array<string|int, mixed> $record, int $offset[, int|null $line = null ][, null|string $raw = null ][, null|array<string|int, mixed> $fields = null ]) : array<int, CorruptedRecordException|Rows>
Parameters
$record : array<string|int, mixed>
$offset : int
$line : int|null = null
$raw : null|string = null

the record as the source holds it; null when the source holds no text of it

$fields : null|array<string|int, mixed> = null

the cells a grid reader split the record into, before keying them by header

Tags
throws
InferredSchemaException|SchemaMismatchException

a refused record under an inferred schema

Return values
array<int, CorruptedRecordException|Rows> —

a full batch's refused records, then its rows; [] while the batch is filling

flush()

Under a declared schema a record with a value that does not cast is a corrupted record, handed up and left out of the rows; under an inferred schema it is a schema error.

public flush() : array<int, CorruptedRecordException|Rows>
Tags
throws
InferredSchemaException|SchemaMismatchException

a refused record under an inferred schema

Return values
array<int, CorruptedRecordException|Rows> —

the records refused, in the order they were added, then the rows of the rest; [] when none

inferred()

public static inferred(Schema $schema, Backend $backend, int<1, max> $batchSize, string|null $uri, null|int<1, max> $sampleSize[, Schema|null $known = null ]) : self
Parameters
$schema : Schema
$backend : Backend
$batchSize : int<1, max>
$uri : string|null
$sampleSize : null|int<1, max>

the rows the schema was inferred from; null for every row

$known : Schema|null = null
Return values
self
On this page

Search results