tustvold commented on code in PR #4520:
URL: https://github.com/apache/arrow-rs/pull/4520#discussion_r1268071969


##########
arrow-string/src/length.rs:
##########
@@ -88,6 +88,20 @@ where
     unary_offsets!(array, T::DATA_TYPE, |x| x)
 }
 
+fn length_list_fixed_size<T>(array: &dyn Array, length: i32) -> ArrayRef
+where
+    T: ArrowPrimitiveType,
+{
+    let array = array.as_any().downcast_ref::<FixedSizeListArray>().unwrap();
+    let length_list = array.len();
+    let buffer = Buffer::from_vec(vec![length; length_list]);
+
+    let data: PrimitiveArray<T> =

Review Comment:
   Can we remove T and just use Int32Array?



##########
arrow-string/src/length.rs:
##########
@@ -88,6 +88,20 @@ where
     unary_offsets!(array, T::DATA_TYPE, |x| x)
 }
 
+fn length_list_fixed_size<T>(array: &dyn Array, length: i32) -> ArrayRef
+where
+    T: ArrowPrimitiveType,
+{
+    let array = array.as_any().downcast_ref::<FixedSizeListArray>().unwrap();
+    let length_list = array.len();
+    let buffer = Buffer::from_vec(vec![length; length_list]);

Review Comment:
   This assumes T::Native is i32



##########
arrow-string/src/length.rs:
##########
@@ -88,6 +88,20 @@ where
     unary_offsets!(array, T::DATA_TYPE, |x| x)
 }
 
+fn length_list_fixed_size<T>(array: &dyn Array, length: i32) -> ArrayRef
+where
+    T: ArrowPrimitiveType,
+{
+    let array = array.as_any().downcast_ref::<FixedSizeListArray>().unwrap();

Review Comment:
   ```suggestion
       let array = array.as_fixed_size_list();
   ```
   



##########
arrow-string/src/length.rs:
##########
@@ -88,6 +88,20 @@ where
     unary_offsets!(array, T::DATA_TYPE, |x| x)
 }
 
+fn length_list_fixed_size<T>(array: &dyn Array, length: i32) -> ArrayRef
+where
+    T: ArrowPrimitiveType,
+{
+    let array = array.as_any().downcast_ref::<FixedSizeListArray>().unwrap();
+    let length_list = array.len();
+    let buffer = Buffer::from_vec(vec![length; length_list]);
+
+    let data: PrimitiveArray<T> =
+        PrimitiveArray::new(buffer.into(), array.nulls().cloned());
+
+    make_array(data.into())

Review Comment:
   ```suggestion
       Arc::new(data)
   ```
   



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