Skip to content
Search
Examples

Batching

Description

A batch stores one column per schema definition, and the backend set with config_builder()->backend() builds every one of them. AdaptiveBackend, the default, picks RustBackend when the flow_php extension is loaded and PhpBackend otherwise. Set PhpBackend to opt out of the extension; both give the same values.

Documentation

Code

<?php

declare(strict_types=1);

use Flow\ETL\Column\PhpBackend;

use function Flow\ETL\DSL\{config_builder, data_frame, from_array, lit, ref};

require __DIR__ . '/vendor/autoload.php';

$rows = data_frame(config_builder()->backend(new PhpBackend()))
    ->read(from_array([['id' => 1], ['id' => 2], ['id' => 3]]))
    ->withColumn('double', ref('id')->multiply(lit(2)))
    ->fetch();

foreach (['id', 'double'] as $name) {
    $column = $rows->column($name);

    echo $name . ': ' . $column::class . ' ' . json_encode($column->values()) . "\n";
}
Contributors

Built in the open.

Join us on GitHub
scroll back to top