You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/01/03 13:24:53 UTC

[GitHub] [arrow] alamb commented on a change in pull request #9066: ARROW-11097: [Rust] Minor simplification of some tests.

alamb commented on a change in pull request #9066:
URL: https://github.com/apache/arrow/pull/9066#discussion_r551005680



##########
File path: rust/arrow/src/array/array_struct.rs
##########
@@ -303,27 +302,21 @@ mod tests {
 
     #[test]
     fn test_struct_array_from() {
-        let boolean_data = ArrayData::builder(DataType::Boolean)
-            .len(4)
-            .add_buffer(Buffer::from([12_u8]))
-            .build();
-        let int_data = ArrayData::builder(DataType::Int32)
-            .len(4)
-            .add_buffer(Buffer::from([42, 28, 19, 31].to_byte_slice()))
-            .build();
+        let boolean = Arc::new(BooleanArray::from(vec![false, false, true, true]));

Review comment:
       this change certainly looks much better to me 👍 

##########
File path: rust/arrow/src/array/array_struct.rs
##########
@@ -270,27 +270,26 @@ mod tests {
 
     use std::sync::Arc;
 
-    use crate::datatypes::{DataType, Field};
     use crate::{
         array::BooleanArray, array::Float32Array, array::Float64Array, array::Int32Array,
         array::StringArray, bitmap::Bitmap,
     };
+    use crate::{
+        array::Int64Array,
+        datatypes::{DataType, Field},
+    };
     use crate::{buffer::Buffer, datatypes::ToByteSlice};
 
     #[test]
     fn test_struct_array_builder() {
-        let boolean_data = ArrayData::builder(DataType::Boolean)
-            .len(4)
-            .add_buffer(Buffer::from([false, false, true, true].to_byte_slice()))

Review comment:
       it might be worth filing a ticket about the issue in `ToByteSlice` - maybe others will be interesting in working / able to work on it




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

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