viirya commented on code in PR #2383:
URL: https://github.com/apache/arrow-rs/pull/2383#discussion_r940954693
##########
arrow/src/array/array_decimal.rs:
##########
@@ -71,44 +71,47 @@ use crate::util::decimal::{BasicDecimal, Decimal128,
Decimal256};
/// assert_eq!(6, decimal_array.scale());
/// ```
///
-pub struct Decimal128Array {
- data: ArrayData,
- value_data: RawPtrBox<u8>,
- precision: usize,
- scale: usize,
-}
+pub type Decimal128Array = BasicDecimalArray<16>;
-pub struct Decimal256Array {
- data: ArrayData,
- value_data: RawPtrBox<u8>,
- precision: usize,
- scale: usize,
-}
+pub type Decimal256Array = BasicDecimalArray<32>;
mod private_decimal {
pub trait DecimalArrayPrivate {
fn raw_value_data_ptr(&self) -> *const u8;
}
}
-pub trait BasicDecimalArray<T: BasicDecimal, U: From<ArrayData>>:
- private_decimal::DecimalArrayPrivate
-{
- const VALUE_LENGTH: i32;
- const DEFAULT_TYPE: DataType;
- const MAX_PRECISION: usize;
- const MAX_SCALE: usize;
+pub struct BasicDecimalArray<const BYTE_WIDTH: usize> {
Review Comment:
We still have no idea how to constrain byte width, right?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]