Flow PHP

functions.php

Functions

telemetry_options()

telemetry_options([bool $trace_loading = false ][, bool $trace_transformations = false ][, bool $trace_cache = false ][, bool $collect_metrics = false ]) : TelemetryOptions
Parameters
$trace_loading : bool = false
$trace_transformations : bool = false
$trace_cache : bool = false
$collect_metrics : bool = false
Return values
TelemetryOptions

from_path_partitions()

from_path_partitions(Path|string $path[, Filesystem $filesystem = new NativeLocalFilesystem() ]) : FileListingExtractor
Parameters
$path : Path|string
$filesystem : Filesystem = new NativeLocalFilesystem()
Return values
FileListingExtractor

from_array()

from_array(iterable<string|int, array<string|int, mixed>> $array[, null|Schema $schema = null ][, Filesystem $filesystem = new NativeLocalFilesystem() ][, null|Path $spillRoot = null ]) : ArrayExtractor
Parameters
$array : iterable<string|int, array<string|int, mixed>>
$schema : null|Schema = null
  • @deprecated use withSchema() method instead
$filesystem : Filesystem = new NativeLocalFilesystem()
$spillRoot : null|Path = null
  • where a non-array $array is spilled while it is described; null resolves to $filesystem->getSystemTmpDir() and only on that path
Return values
ArrayExtractor

from_cache()

from_cache(string $id[, null|Extractor $fallback_extractor = null ][, bool $clear = false ][, RowsStorage|null $cache = null ]) : CacheExtractor
Parameters
$id : string
  • cache id from which data will be extracted
$fallback_extractor : null|Extractor = null
  • extractor that will be used when cache is empty - @deprecated use withFallbackExtractor() method instead
$clear : bool = false
  • clear cache after extraction - @deprecated use withClearOnFinish() method instead
$cache : RowsStorage|null = null
Return values
CacheExtractor

files()

files(string|Path $directory[, Filesystem $filesystem = new NativeLocalFilesystem() ]) : FileListingExtractor
Parameters
$directory : string|Path
$filesystem : Filesystem = new NativeLocalFilesystem()
Return values
FileListingExtractor

from_sequence_date_period()

from_sequence_date_period(string $column_name, DateTimeInterface $start, DateInterval $interval, DateTimeInterface $end[, int $options = 0 ]) : SequenceExtractor
Parameters
$column_name : string
$start : DateTimeInterface
$interval : DateInterval
$end : DateTimeInterface
$options : int = 0
Return values
SequenceExtractor

from_sequence_date_period_recurrences()

from_sequence_date_period_recurrences(string $column_name, DateTimeInterface $start, DateInterval $interval, int $recurrences[, int $options = 0 ]) : SequenceExtractor
Parameters
$column_name : string
$start : DateTimeInterface
$interval : DateInterval
$recurrences : int
$options : int = 0
Return values
SequenceExtractor

from_sequence_number()

from_sequence_number(string $column_name, string|int|float $start, string|int|float $end[, int|float $step = 1 ]) : SequenceExtractor
Parameters
$column_name : string
$start : string|int|float
$end : string|int|float
$step : int|float = 1
Return values
SequenceExtractor

to_array()

Convert rows to an array and store them in passed array variable.

to_array(array<string|int, mixed> &$array) : ArrayLoader
Parameters
$array : array<string|int, mixed>
Tags
param-out

array<array> $array

Return values
ArrayLoader

to_stream()

to_stream(string $uri[, int|bool $truncate = 20 ][, Output $output = Output::rows ][, string $mode = 'w' ][, Formatter $formatter = new AsciiTableFormatter() ][, SchemaFormatter $schemaFormatter = new ASCIISchemaFormatter() ]) : StreamLoader
Parameters
$uri : string
$truncate : int|bool = 20
$output : Output = Output::rows
$mode : string = 'w'
$formatter : Formatter = new AsciiTableFormatter()
$schemaFormatter : SchemaFormatter = new ASCIISchemaFormatter()
Return values
StreamLoader

structure()

Builds a structure from scalar functions: one element per key, in key order.

structure(array<string|int, ScalarFunction> $elements) : Structure

An element is nullable when its function is; the structure itself never is.

Parameters
$elements : array<string|int, ScalarFunction>
Return values
Structure

mask_columns()

mask_columns([array<int, string> $columns = [] ][, string $mask = '******' ]) : MaskColumns
Parameters
$columns : array<int, string> = []
$mask : string = '******'
Return values
MaskColumns

when()

when(mixed $condition, mixed $then[, mixed $else = null ]) : When
Parameters
$condition : mixed
$then : mixed
$else : mixed = null
Return values
When

cast()

cast(mixed $value, Type<string|int, mixed>|string $type) : Cast
Parameters
$value : mixed
$type : Type<string|int, mixed>|string
Return values
Cast

call()

Calls a user-defined function with the given parameters.

call(ScalarFunction $callable, Type<string|int, mixed> $return_type[, array<string|int, mixed> $parameters = [] ]) : CallUserFunc
Parameters
$callable : ScalarFunction
$return_type : Type<string|int, mixed>
$parameters : array<string|int, mixed> = []
Return values
CallUserFunc

array_unpack()

Unpacks each element of an array into a new column, using the array key as the column name.

array_unpack(array<string|int, mixed>|ScalarFunction $array, Schema $schema) : ArrayUnpack

Before: +--+-------------------+ |id| array| +--+-------------------+ | 1|{"a":1,"b":2,"c":3}| | 2|{"d":4,"e":5,"f":6}| +--+-------------------+

After: +--+-----+-----+-----+-----+-----+ |id|arr.b|arr.c|arr.d|arr.e|arr.f| +--+-----+-----+-----+-----+-----+ | 1| 2| 3| | | | | 2| | | 4| 5| 6| +--+-----+-----+-----+-----+-----+

Parameters
$array : array<string|int, mixed>|ScalarFunction
$schema : Schema
Return values
ArrayUnpack

array_expand()

Expands each value into a column, if there are more than one value, multiple rows will be created.

array_expand(ScalarFunction $function[, ArrayExpand $expand = ArrayExpand::VALUES ]) : ArrayExpand

Array keys are ignored, only values are used to create new rows. Nested in another function (structure(), concat(), ...) it still gives one row per element. Several expands in one expression are zipped to the longest list; a shorter one gives null, so its element type becomes nullable. It is refused inside another array_expand() and in filter(), until(), duplicateRow(), aggregate(), over() and onEach().

Before: +--+-------------------+ |id| array| +--+-------------------+ | 1|{"a":1,"b":2,"c":3}| +--+-------------------+

After: +--+--------+ |id|expanded| +--+--------+ | 1| 1| | 1| 2| | 1| 3| +--+--------+

Parameters
$function : ScalarFunction
$expand : ArrayExpand = ArrayExpand::VALUES
Return values
ArrayExpand

schema_to_json()

schema_to_json(Schema $schema[, bool $pretty = false ]) : string
Parameters
$schema : Schema
$pretty : bool = false
Return values
string

schema_from_json()

schema_from_json(string $schema) : Schema
Parameters
$schema : string
Return values
Schema

schema_metadata()

schema_metadata([array<string, array<string|int, bool|float|int|string>|bool|float|int|string> $metadata = [] ]) : Metadata
Parameters
$metadata : array<string, array<string|int, bool|float|int|string>|bool|float|int|string> = []
Return values
Metadata

map_schema()

map_schema(string $name, MapType|Type $type[, bool $nullable = false ][, Metadata|null $metadata = null ]) : MapDefinition<TKey, TValue>
Parameters
$name : string
$type : MapType|Type
$nullable : bool = false
$metadata : Metadata|null = null
Tags
template
Return values
MapDefinition<TKey, TValue>

list_schema()

list_schema(string $name, ListType<string|int, T>|Type<string|int, array<int, T>> $type[, bool $nullable = false ][, Metadata|null $metadata = null ]) : ListDefinition<string|int, T>
Parameters
$name : string
$type : ListType<string|int, T>|Type<string|int, array<int, T>>
$nullable : bool = false
$metadata : Metadata|null = null
Tags
template
Return values
ListDefinition<string|int, T>

enum_schema()

enum_schema(string $name, T> $type[, bool $nullable = false ][, Metadata|null $metadata = null ]) : EnumDefinition<string|int, T>
Parameters
$name : string
$type : T>
$nullable : bool = false
$metadata : Metadata|null = null
Tags
template
Return values
EnumDefinition<string|int, T>

datetime_schema()

datetime_schema(string $name[, bool $nullable = false ][, Metadata|null $metadata = null ][, DateTimeZone|string $zone = 'UTC' ]) : DateTimeDefinition
Parameters
$name : string
$nullable : bool = false
$metadata : Metadata|null = null
$zone : DateTimeZone|string = 'UTC'
Return values
DateTimeDefinition

structure_schema()

structure_schema(string $name, StructureType<string|int, array<string|int, T>>|Type<string|int, array<string|int, T>> $type[, bool $nullable = false ][, Metadata|null $metadata = null ]) : StructureDefinition<string|int, T>
Parameters
$name : string
$type : StructureType<string|int, array<string|int, T>>|Type<string|int, array<string|int, T>>
$nullable : bool = false
$metadata : Metadata|null = null
Tags
template
Return values
StructureDefinition<string|int, T>

definition_from_array()

Create a Definition from an array representation.

definition_from_array(array<string|int, mixed> $definition) : Definition<string|int, mixed>
Parameters
$definition : array<string|int, mixed>
Return values
Definition<string|int, mixed>

definition_from_type()

Create a Definition from a Type.

definition_from_type(string|Reference $ref, Type<string|int, mixed> $type[, bool $nullable = false ][, Metadata|null $metadata = null ]) : Definition<string|int, mixed>
Parameters
$ref : string|Reference
$type : Type<string|int, mixed>
$nullable : bool = false
$metadata : Metadata|null = null
Return values
Definition<string|int, mixed>

pivot_values()

Declares the pivot columns a groupBy()->pivot() produces, so the plan can name them before a row flows.

pivot_values(int|string ...$values) : DeclaredPivotValues
Parameters
$values : int|string
Return values
DeclaredPivotValues

discover_pivot_values()

Reads the pivot column once at build time and turns what it finds into declared values. Refuses a source that cannot be read twice.

discover_pivot_values([int $maxValues = 10000 ]) : DiscoveredPivotValues
Parameters
$maxValues : int = 10000
Return values
DiscoveredPivotValues

partition_types()

partition_types(Type<string|int, mixed> ...$types) : PartitionTypes
Parameters
$types : Type<string|int, mixed>

partition column name => type, passed as named arguments

Return values
PartitionTypes

print_rows()

print_rows(Rows $rows[, int|bool $truncate = false ][, Formatter|null $formatter = null ]) : string
Parameters
$rows : Rows
$truncate : int|bool = false
$formatter : Formatter|null = null
Return values
string

is_type()

is_type(array<string|int, string|Type<string|int, mixed>>|Type<string|int, mixed> $type, mixed $value) : bool
Parameters
$type : array<string|int, string|Type<string|int, mixed>>|Type<string|int, mixed>
$value : mixed
Return values
bool

date_interval_to_milliseconds()

date_interval_to_milliseconds(DateInterval $interval) : int
Parameters
$interval : DateInterval
Return values
int

date_interval_to_seconds()

date_interval_to_seconds(DateInterval $interval) : int
Parameters
$interval : DateInterval
Return values
int

date_interval_to_microseconds()

date_interval_to_microseconds(DateInterval $interval) : int
Parameters
$interval : DateInterval
Return values
int

clock()

clock([string $time_zone = 'UTC' ]) : ClockInterface
Parameters
$time_zone : string = 'UTC'
Return values
ClockInterface
On this page

Search results