From e95b774008dc344788a2891acf13d503ecccf278 Mon Sep 17 00:00:00 2001 From: Liang-Chi Hsieh Date: Tue, 9 Aug 2022 09:22:16 -0700 Subject: [PATCH] Clean up --- arrow/src/array/array_decimal.rs | 10 ++-------- arrow/src/util/decimal.rs | 11 +++++------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/arrow/src/array/array_decimal.rs b/arrow/src/array/array_decimal.rs index 781ed5f8f625..412b74c60a12 100644 --- a/arrow/src/array/array_decimal.rs +++ b/arrow/src/array/array_decimal.rs @@ -75,12 +75,6 @@ pub type Decimal128Array = BasicDecimalArray<16>; pub type Decimal256Array = BasicDecimalArray<32>; -mod private_decimal { - pub trait DecimalArrayPrivate { - fn raw_value_data_ptr(&self) -> *const u8; - } -} - pub struct BasicDecimalArray { data: ArrayData, value_data: RawPtrBox, @@ -90,10 +84,10 @@ pub struct BasicDecimalArray { impl BasicDecimalArray { pub const VALUE_LENGTH: i32 = BYTE_WIDTH as i32; - pub const DEFAULT_TYPE: DataType = BasicDecimal::::DEFAULT_TYPE; + const DEFAULT_TYPE: DataType = BasicDecimal::::DEFAULT_TYPE; pub const MAX_PRECISION: usize = BasicDecimal::::MAX_PRECISION; pub const MAX_SCALE: usize = BasicDecimal::::MAX_SCALE; - pub const TYPE_CONSTRUCTOR: fn(usize, usize) -> DataType = + const TYPE_CONSTRUCTOR: fn(usize, usize) -> DataType = BasicDecimal::::TYPE_CONSTRUCTOR; pub fn data(&self) -> &ArrayData { diff --git a/arrow/src/util/decimal.rs b/arrow/src/util/decimal.rs index 74f3379f4c10..10bd13f7e59e 100644 --- a/arrow/src/util/decimal.rs +++ b/arrow/src/util/decimal.rs @@ -35,7 +35,7 @@ pub struct BasicDecimal { impl BasicDecimal { #[allow(clippy::type_complexity)] - const _MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE: ( + const MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE: ( usize, usize, fn(usize, usize) -> DataType, @@ -56,13 +56,12 @@ impl BasicDecimal { _ => panic!("invalid byte width"), }; - pub const MAX_PRECISION: usize = - Self::_MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE.0; - pub const MAX_SCALE: usize = Self::_MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE.1; + pub const MAX_PRECISION: usize = Self::MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE.0; + pub const MAX_SCALE: usize = Self::MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE.1; pub const TYPE_CONSTRUCTOR: fn(usize, usize) -> DataType = - Self::_MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE.2; + Self::MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE.2; pub const DEFAULT_TYPE: DataType = - Self::_MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE.3; + Self::MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE.3; /// Tries to create a decimal value from precision, scale and bytes. /// If the length of bytes isn't same as the bit width of this decimal,