Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix check decimal scale equal to precision #231

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading