diff --git a/composer.json b/composer.json index bf06c2b8f..676715286 100644 --- a/composer.json +++ b/composer.json @@ -69,6 +69,7 @@ "src/core/etl/src/Flow/ETL/DSL/functions.php", "src/lib/array-dot/src/Flow/ArrayDot/array_dot.php", "src/lib/parquet/src/Flow/Parquet/functions.php", + "src/lib/parquet/src/Flow/Parquet/polyfill.php", "src/lib/snappy/polifil.php" ], "psr-4": { diff --git a/src/lib/parquet/composer.json b/src/lib/parquet/composer.json index 36a5b2f46..336b653e1 100644 --- a/src/lib/parquet/composer.json +++ b/src/lib/parquet/composer.json @@ -31,7 +31,8 @@ ] }, "files": [ - "src/Flow/Parquet/functions.php" + "src/Flow/Parquet/functions.php", + "src/Flow/Parquet/polyfill.php" ] }, "autoload-dev": { diff --git a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Codec.php b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Codec.php index 72dc0caad..ae1b26531 100644 --- a/src/lib/parquet/src/Flow/Parquet/ParquetFile/Codec.php +++ b/src/lib/parquet/src/Flow/Parquet/ParquetFile/Codec.php @@ -25,6 +25,9 @@ public function compress(string $data, Compressions $compression) : string Compressions::SNAPPY => \snappy_compress($data), /** @phpstan-ignore-next-line */ Compressions::GZIP => \gzencode($data, $this->options->get(Option::GZIP_COMPRESSION_LEVEL)), + Compressions::BROTLI => \brotli_compress($data), + Compressions::LZ4 => \lz4_compress($data), + Compressions::ZSTD => \zstd_compress($data), default => throw new RuntimeException('Compression ' . $compression->name . ' is not supported yet') }; @@ -42,6 +45,9 @@ public function decompress(string $data, Compressions $compression) : string Compressions::UNCOMPRESSED => $data, Compressions::SNAPPY => \snappy_uncompress($data), Compressions::GZIP => \gzdecode($data), + Compressions::BROTLI => \brotli_uncompress($data), + Compressions::LZ4 => \lz4_uncompress($data), + Compressions::ZSTD => \zstd_uncompress($data), default => throw new RuntimeException('Compression ' . $compression->name . ' is not supported yet') }; diff --git a/src/lib/parquet/src/Flow/Parquet/Writer.php b/src/lib/parquet/src/Flow/Parquet/Writer.php index fdb167a84..9e3841f1d 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer.php @@ -38,6 +38,9 @@ public function __construct( case Compressions::UNCOMPRESSED: case Compressions::SNAPPY: case Compressions::GZIP: + case Compressions::BROTLI: + case Compressions::LZ4: + case Compressions::ZSTD: break; default: diff --git a/src/lib/parquet/src/Flow/Parquet/polyfill.php b/src/lib/parquet/src/Flow/Parquet/polyfill.php new file mode 100644 index 000000000..e25a24070 --- /dev/null +++ b/src/lib/parquet/src/Flow/Parquet/polyfill.php @@ -0,0 +1,47 @@ +