codename-hub / php-parquet

PHP implementation for reading and writing Apache Parquet files/streams
Other
58 stars 8 forks source link

can't write data to aws S3 stream #19

Closed billjazz closed 1 year ago

billjazz commented 1 year ago
    $disk = Storage::disk('s3');
    $file = 'test.parquet';

    $schema = new Schema([
        DataField::createFromType('id', 'integer'),
        DataField::createFromType('name', 'string'),
    ]);

    $handle = $disk->readStream($file);

    $dataWriter = new ParquetDataWriter($handle, $schema);

    // add two records at once
    $dataToWrite = [
        [ 'id' => 1, 'name' => 'abc' ],
        [ 'id' => 2, 'name' => 'def' ],
    ];
    $dataWriter->putBatch($dataToWrite);

    $dataWriter->finish(); // Don't forget to finish at some point.

the $handle is a file resource, but it can't write the data in the Stream.

Katalystical commented 1 year ago

Do you see any problem with this line? (Rhetorical question)

$handle = $disk->readStream($file);