Jefffrey commented on code in PR #7062:
URL: https://github.com/apache/arrow-rs/pull/7062#discussion_r1946694580


##########
arrow-ord/src/sort.rs:
##########
@@ -795,10 +795,18 @@ mod tests {
     use rand::seq::SliceRandom;
     use rand::{Rng, RngCore, SeedableRng};
 
-    fn create_decimal128_array(data: Vec<Option<i128>>) -> Decimal128Array {
+    fn create_decimal_array<T: DecimalType>(
+        data: Vec<Option<usize>>,
+        precision: u8,
+        scale: i8,
+    ) -> PrimitiveArray<T> {
         data.into_iter()
-            .collect::<Decimal128Array>()
-            .with_precision_and_scale(23, 6)
+            .map(|x| match x {
+                None => None,
+                Some(y) => T::Native::from_usize(y),
+            })

Review Comment:
   ```suggestion
               .map(|x| x.and_then(T::Native::from_usize))
   ```



##########
arrow-cast/src/cast/mod.rs:
##########
@@ -2888,96 +2770,103 @@ mod tests {
         );
     }
 
+    macro_rules! generate_decimal_to_numeric_cast_test_case {
+        ($INPUT_ARRAY: expr) => {

Review Comment:
   ```suggestion
       fn generate_decimal_to_numeric_cast_test_case<T>(array: 
&PrimitiveArray<T>)
       where
           T: ArrowPrimitiveType + DecimalType,
       {
   ```
   
   I personally prefer generics, but not too much difference anyway



##########
arrow-ord/src/sort.rs:
##########
@@ -795,10 +795,18 @@ mod tests {
     use rand::seq::SliceRandom;
     use rand::{Rng, RngCore, SeedableRng};
 
-    fn create_decimal128_array(data: Vec<Option<i128>>) -> Decimal128Array {
+    fn create_decimal_array<T: DecimalType>(
+        data: Vec<Option<usize>>,

Review Comment:
   Makes sense to me, especially as the data thats created from here doesn't 
need the full range of i128/i256 anyway :+1: 



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