Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
return error for invalid decimal length
Browse files Browse the repository at this point in the history
jp0317 committed Dec 19, 2024
1 parent 55f3f64 commit 21e7bf9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion parquet/src/schema/types.rs
Original file line number Diff line number Diff line change
@@ -556,7 +556,9 @@ impl<'a> PrimitiveTypeBuilder<'a> {
}
}
PhysicalType::FIXED_LEN_BYTE_ARRAY => {
let length = self.length.checked_mul(8).unwrap_or(i32::MAX);
let length = self.length.checked_mul(8).ok_or(
general_err!("Invalid length {} for Decimal", self.length)
)?;
let max_precision = (2f64.powi(length - 1) - 1f64).log10().floor() as i32;

if self.precision > max_precision {

0 comments on commit 21e7bf9

Please sign in to comment.