You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/04/04 20:42:24 UTC

[GitHub] [arrow-rs] alamb commented on a diff in pull request #4019: Deprecate Array::data (#3880)

alamb commented on code in PR #4019:
URL: https://github.com/apache/arrow-rs/pull/4019#discussion_r1157741260


##########
arrow-select/src/concat.rs:
##########
@@ -81,7 +81,8 @@ pub fn concat(arrays: &[&dyn Array]) -> Result<ArrayRef, ArrowError> {
         _ => Capacities::Array(arrays.iter().map(|a| a.len()).sum()),
     };
 
-    let array_data = arrays.iter().map(|a| a.data()).collect::<Vec<_>>();
+    let array_data: Vec<_> = arrays.iter().map(|a| a.to_data()).collect::<Vec<_>>();
+    let array_data = array_data.iter().collect();

Review Comment:
   why do we need the second iter/collect? 
   
   Update: Because it wants a Vec of `&ArrayData`



##########
arrow-cast/src/cast.rs:
##########
@@ -4875,15 +4874,9 @@ mod tests {
         assert_eq!(0, cast_array.null_count());
 
         // offsets should be the same
-        assert_eq!(

Review Comment:
   Is the equality comparison still covered?



##########
arrow-select/src/interleave.rs:
##########
@@ -193,7 +193,8 @@ fn interleave_fallback(
     values: &[&dyn Array],
     indices: &[(usize, usize)],
 ) -> Result<ArrayRef, ArrowError> {
-    let arrays: Vec<_> = values.iter().map(|x| x.data()).collect();
+    let arrays: Vec<_> = values.iter().map(|x| x.to_data()).collect();
+    let arrays: Vec<_> = arrays.iter().collect();

Review Comment:
   We could potentially change the `MutableArrayData` constructor to take `impl IntoIterator<Item = &'ArrayData>` but that seems like it just moves the copy around.



##########
arrow-array/src/array/binary_array.rs:
##########
@@ -467,9 +467,6 @@ mod tests {
         let list_array = GenericListArray::<O>::from(array_data2);
         let binary_array2 = GenericBinaryArray::<O>::from(list_array);
 
-        assert_eq!(2, binary_array2.data().buffers().len());

Review Comment:
   This test is no longer needed because the ArrayData builder will check the buffer count (is that correct)?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org