From 2597c9abc63a599a2bf07ee59c881defef58dafa Mon Sep 17 00:00:00 2001 From: jp0317 Date: Thu, 19 Dec 2024 16:16:08 +0000 Subject: [PATCH] return error for invalid decimal length --- parquet/src/schema/types.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parquet/src/schema/types.rs b/parquet/src/schema/types.rs index 0347f7da46d..d9e9b22e809 100644 --- a/parquet/src/schema/types.rs +++ b/parquet/src/schema/types.rs @@ -556,7 +556,10 @@ 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 {