viirya commented on code in PR #2383:
URL: https://github.com/apache/arrow-rs/pull/2383#discussion_r940960239


##########
arrow/src/util/decimal.rs:
##########
@@ -18,21 +18,51 @@
 //! Decimal related utils
 
 use crate::datatypes::{
-    DECIMAL128_MAX_PRECISION, DECIMAL128_MAX_SCALE, DECIMAL256_MAX_PRECISION,
-    DECIMAL256_MAX_SCALE,
+    DataType, DECIMAL128_MAX_PRECISION, DECIMAL128_MAX_SCALE, 
DECIMAL256_MAX_PRECISION,
+    DECIMAL256_MAX_SCALE, DECIMAL_DEFAULT_SCALE,
 };
 use crate::error::{ArrowError, Result};
 use num::bigint::BigInt;
 use num::Signed;
 use std::cmp::{min, Ordering};
 
-pub trait BasicDecimal: PartialOrd + Ord + PartialEq + Eq {
-    /// The bit-width of the internal representation.
-    const BIT_WIDTH: usize;
-    /// The maximum precision.
-    const MAX_PRECISION: usize;
-    /// The maximum scale.
-    const MAX_SCALE: usize;
+#[derive(Debug)]
+pub struct BasicDecimal<const BYTE_WIDTH: usize> {
+    precision: usize,
+    scale: usize,
+    value: [u8; BYTE_WIDTH],
+}
+
+impl<const BYTE_WIDTH: usize> BasicDecimal<BYTE_WIDTH> {
+    #[allow(clippy::type_complexity)]
+    const _MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE: (

Review Comment:
   As this is not pub, I think `MAX_PRECISION_SCALE_CONSTRUCTOR_DEFAULT_TYPE` 
might be okay. A `_` prefix seems redundant.
   



-- 
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]

Reply via email to