Weijun-H commented on code in PR #9110:
URL: https://github.com/apache/arrow-datafusion/pull/9110#discussion_r1476921297


##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -2246,38 +2246,41 @@ fn generic_list_cardinality<O: OffsetSizeTrait>(
 }
 
 // Create new offsets that are euqiavlent to `flatten` the array.
-fn get_offsets_for_flatten(
-    offsets: OffsetBuffer<i32>,
-    indexes: OffsetBuffer<i32>,
-) -> OffsetBuffer<i32> {
+fn get_offsets_for_flatten<O: OffsetSizeTrait>(
+    offsets: OffsetBuffer<O>,
+    indexes: OffsetBuffer<O>,
+) -> OffsetBuffer<O> {
     let buffer = offsets.into_inner();
-    let offsets: Vec<i32> = indexes.iter().map(|i| buffer[*i as 
usize]).collect();
+    let offsets: Vec<O> = indexes
+        .iter()
+        .map(|i| buffer[i.to_usize().unwrap()])

Review Comment:
   We cannot cast it as usize directly because `*i` is `OffsetSizeTrait`



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