Example: Parquet
Topic: Data reading
Description
Read data from a parquet file.
function from_parquet(string|Path $uri);
Additional options:
withColumns(array $columns)
- default [], list of columns to read when not set, all columns will be read
withOptions(Options $options)
- custom Parquet Reader Options
withByteOrder(ByteOrder $order)
- default ByteOrder::LITTLE_ENDIAN
, the byte order of the parquet file
withOffset(int $offset)
- default null, rows to skip from the beginning of the file
composer.json
{
"name": "flow-php/examples",
"description": "Flow PHP - Examples",
"license": "MIT",
"type": "library",
"require": {
"flow-php/etl": "1.x-dev",
"flow-php/etl-adapter-parquet": "1.x-dev"
}
}
code.php
<?php
declare(strict_types=1);
use function Flow\ETL\Adapter\Parquet\from_parquet;
use function Flow\ETL\DSL\{data_frame, to_stream};
require __DIR__ . '/vendor/autoload.php';
data_frame()
->read(from_parquet(
__DIR__ . '/input/dataset.parquet',
))
->collect()
->write(to_stream(__DIR__ . '/output.txt', truncate: false))
->run();