xanderbailey commented on code in PR #2887:
URL: https://github.com/apache/iceberg-rust/pull/2887#discussion_r3688779272
##########
crates/iceberg/src/writer/file_writer/parquet_writer.rs:
##########
@@ -110,6 +125,62 @@ impl ParquetWriterBuilder {
}
}
+fn parquet_compression(codec: &str, level: Option<i32>) -> Result<Compression>
{
+ let compression = match codec.to_lowercase().as_str() {
+ "uncompressed" | "none" => Compression::UNCOMPRESSED,
+ "snappy" => Compression::SNAPPY,
+ "lzo" => Compression::LZO,
+ "lz4" => Compression::LZ4,
+ "lz4_raw" => Compression::LZ4_RAW,
+ "gzip" => {
+ let level = match level {
+ Some(l) => level_as_u32("gzip", l)?,
+ None => DEFAULT_GZIP_COMPRESSION_LEVEL,
+ };
+ let level = GzipLevel::try_new(level).map_err(|e|
invalid_level_error("gzip", e))?;
+ Compression::GZIP(level)
+ }
+ "brotli" => {
+ let level = match level {
+ Some(l) => level_as_u32("brotli", l)?,
+ None => DEFAULT_BROTLI_COMPRESSION_LEVEL,
+ };
+ let level =
+ BrotliLevel::try_new(level).map_err(|e|
invalid_level_error("brotli", e))?;
+ Compression::BROTLI(level)
+ }
+ "zstd" => {
+ let level = level.unwrap_or(DEFAULT_ZSTD_COMPRESSION_LEVEL);
Review Comment:
It’s actually just an parquet-rs api limitation, zstd accepts i32, the
others require u32
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]