Skip to content

Commit

Permalink
Clean up (#2389)
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya authored Aug 9, 2022
1 parent b55e3b1 commit 31560a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
10 changes: 2 additions & 8 deletions arrow/src/array/array_decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<const BYTE_WIDTH: usize> {
data: ArrayData,
value_data: RawPtrBox<u8>,
Expand All @@ -90,10 +84,10 @@ pub struct BasicDecimalArray<const BYTE_WIDTH: usize> {

impl<const BYTE_WIDTH: usize> BasicDecimalArray<BYTE_WIDTH> {
pub const VALUE_LENGTH: i32 = BYTE_WIDTH as i32;
pub const DEFAULT_TYPE: DataType = BasicDecimal::<BYTE_WIDTH>::DEFAULT_TYPE;
const DEFAULT_TYPE: DataType = BasicDecimal::<BYTE_WIDTH>::DEFAULT_TYPE;
pub const MAX_PRECISION: usize = BasicDecimal::<BYTE_WIDTH>::MAX_PRECISION;
pub const MAX_SCALE: usize = BasicDecimal::<BYTE_WIDTH>::MAX_SCALE;
pub const TYPE_CONSTRUCTOR: fn(usize, usize) -> DataType =
const TYPE_CONSTRUCTOR: fn(usize, usize) -> DataType =
BasicDecimal::<BYTE_WIDTH>::TYPE_CONSTRUCTOR;

pub fn data(&self) -> &ArrayData {
Expand Down
11 changes: 5 additions & 6 deletions arrow/src/util/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct BasicDecimal<const BYTE_WIDTH: usize> {

impl<const BYTE_WIDTH: usize> BasicDecimal<BYTE_WIDTH> {
#[allow(clippy::type_complexity)]
const _MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE: (
const MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE: (
usize,
usize,
fn(usize, usize) -> DataType,
Expand All @@ -56,13 +56,12 @@ impl<const BYTE_WIDTH: usize> BasicDecimal<BYTE_WIDTH> {
_ => 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,
Expand Down

0 comments on commit 31560a3

Please sign in to comment.