Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
xmakro committed Aug 26, 2024
1 parent 52bdce4 commit 48b9241
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion parquet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ twox-hash = { version = "1.6", default-features = false }
paste = { version = "1.0" }
half = { version = "2.1", default-features = false, features = ["num-traits"] }
sysinfo = { version = "0.31.2", optional = true, default-features = false, features = ["system"] }
crc32fast = { version = "1.4.2", optional = true, default-features = false }

[dev-dependencies]
base64 = { version = "0.22", default-features = false, features = ["std"] }
Expand Down Expand Up @@ -96,7 +97,7 @@ zstd-sys = { version = ">=2.0.0, <2.0.14", default-features = false }
all-features = true

[features]
default = ["arrow", "snap", "brotli", "flate2", "lz4", "zstd", "base64", "crc"]
default = ["arrow", "snap", "brotli", "flate2", "lz4", "zstd", "base64"]
# Enable lz4
lz4 = ["lz4_flex"]
# Enable arrow reader/writer APIs
Expand Down
4 changes: 0 additions & 4 deletions parquet/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pub enum ParquetError {
/// Returned when reading into arrow or writing from arrow.
ArrowError(String),
IndexOutOfBound(usize, usize),
Crc32Mismatch,
/// An external error variant
External(Box<dyn Error + Send + Sync>),
}
Expand All @@ -61,9 +60,6 @@ impl std::fmt::Display for ParquetError {
ParquetError::IndexOutOfBound(index, ref bound) => {
write!(fmt, "Index {index} out of bound: {bound}")
}
ParquetError::Crc32Mismatch => {
write!(fmt, "Page CRC checksum mismatch")
}
ParquetError::External(e) => write!(fmt, "External: {e}"),
}
}
Expand Down
4 changes: 3 additions & 1 deletion parquet/src/file/serialized_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,9 @@ pub(crate) fn decode_page(
if let Some(expected_crc) = page_header.crc {
let crc = crc32fast::hash(&buffer);
if crc != expected_crc as u32 {
return Err(ParquetError::Crc32Mismatch);
return Err(ParquetError::General(
"Page CRC checksum mismatch".to_string(),
));
}
}

Expand Down

0 comments on commit 48b9241

Please sign in to comment.