Skip to content

Commit

Permalink
fix check decimal scale equal to precision
Browse files Browse the repository at this point in the history
  • Loading branch information
b41sh committed Sep 8, 2023
1 parent 693c265 commit 3cf9dab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/read/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ pub fn read_metadata<R: Read + Seek>(reader: &mut R) -> Result<FileMetaData> {
}

/// Reads a [`FileMetaData`] from the reader, located at the end of the file, with known file size.
pub fn read_metadata_with_size<R: Read + Seek>(reader: &mut R, file_size: u64) -> Result<FileMetaData> {
pub fn read_metadata_with_size<R: Read + Seek>(
reader: &mut R,
file_size: u64,
) -> Result<FileMetaData> {
if file_size < HEADER_SIZE + FOOTER_SIZE {
return Err(Error::oos(
"A parquet file must containt a header and footer with at least 12 bytes",
Expand Down
4 changes: 2 additions & 2 deletions src/schema/types/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ fn check_decimal_invariants(
precision,
)));
}
if scale >= precision {
if scale > precision {
return Err(Error::oos(format!(
"Invalid DECIMAL: scale ({}) cannot be greater than or equal to precision \
"Invalid DECIMAL: scale ({}) cannot be greater than precision \
({})",
scale, precision
)));
Expand Down

0 comments on commit 3cf9dab

Please sign in to comment.