Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINOR: Remove unused trait and some cleanup #2389

Merged
merged 1 commit into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used anymore.

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;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have default_type so this can be hidden.

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 =
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to be public.

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