Skip to content

Commit

Permalink
Do not print compression level in schema printer
Browse files Browse the repository at this point in the history
The compression level is only used during compression, not
decompression, and isn't actually stored in the metadata. Printing it is
misleading.
  • Loading branch information
ttencate committed Aug 19, 2024
1 parent 27789d7 commit a90ee5b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions parquet/src/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,14 @@ pub enum Compression {
LZ4_RAW,
}

impl Compression {
/// Returns the codec type of this compression setting as a string, without the compression
/// level.
pub(crate) fn codec_to_string(self) -> String {
format!("{:?}", self).split('(').next().unwrap().to_owned()
}
}

fn split_compression_string(str_setting: &str) -> Result<(&str, Option<u32>), ParquetError> {
let split_setting = str_setting.split_once('(');

Expand Down
6 changes: 5 additions & 1 deletion parquet/src/schema/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ fn print_column_chunk_metadata(out: &mut dyn io::Write, cc_metadata: &ColumnChun
writeln!(out, "file path: {file_path_str}");
writeln!(out, "file offset: {}", cc_metadata.file_offset());
writeln!(out, "num of values: {}", cc_metadata.num_values());
writeln!(out, "compression: {}", cc_metadata.compression());
writeln!(
out,
"compression: {}",
cc_metadata.compression().codec_to_string()
);
writeln!(
out,
"total compressed size (in bytes): {}",
Expand Down

0 comments on commit a90ee5b

Please sign in to comment.