From aed4e6e979fbd15befa30a90c9f267c6d370c94f Mon Sep 17 00:00:00 2001 From: congyi wang <58715567+wcy-fdu@users.noreply.github.com> Date: Fri, 18 Oct 2024 20:40:44 +0800 Subject: [PATCH] fix(common): fix conversion between Decimal to arrow Decimal128 (#19007) --- src/common/src/array/arrow/arrow_iceberg.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/src/array/arrow/arrow_iceberg.rs b/src/common/src/array/arrow/arrow_iceberg.rs index 9cb7df6f809a7..ce15c5e3646e6 100644 --- a/src/common/src/array/arrow/arrow_iceberg.rs +++ b/src/common/src/array/arrow/arrow_iceberg.rs @@ -83,8 +83,8 @@ impl IcebergArrowConvert { impl ToArrow for IcebergArrowConvert { #[inline] fn decimal_type_to_arrow(&self, name: &str) -> arrow_schema::Field { - let data_type = - arrow_schema::DataType::Decimal128(arrow_schema::DECIMAL128_MAX_PRECISION, 0); + // Fixed-point decimal; precision P, scale S Scale is fixed, precision must be less than 38. + let data_type = arrow_schema::DataType::Decimal128(28, 10); arrow_schema::Field::new(name, data_type, true) } @@ -178,7 +178,7 @@ impl ToArrow for IcebergCreateTableArrowConvert { // We choose 28 here // The decimal type finally will be converted to an iceberg decimal type. // Iceberg decimal(P,S) - // Fixed-point decimal; precision P, scale S Scale is fixed, precision must be 38 or less. + // Fixed-point decimal; precision P, scale S Scale is fixed, precision must be less than 38. let data_type = arrow_schema::DataType::Decimal128(28, 10); let mut arrow_field = arrow_schema::Field::new(name, data_type, true);