Kurtiscwright commented on code in PR #2887:
URL: https://github.com/apache/iceberg-rust/pull/2887#discussion_r3688243806
##########
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:
Is there a particular reason to move away from the `match level {}` pattern
and the `level_as_u32`?
##########
crates/iceberg/src/writer/file_writer/parquet_writer.rs:
##########
@@ -46,6 +47,16 @@ use crate::transform::create_transform_function;
use crate::writer::{CurrentFileStatus, DataFile};
use crate::{Error, ErrorKind, Result};
+/// Default compression levels, pinned to parquet-java's defaults so files are
Review Comment:
I wish there was an integration test that would start failing if
parquet-java ever changed their defaults.
--
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]