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/01 08:24:35 UTC

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

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



##########
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:
       This is the line that triggered this PR. As per this code shows, `to_byte_slice` can be applied to a `bool`, which promptly converts it to `u8`. However, `bool` is not represented as `u8` in the Arrow specification, but as a single bit. This indicates a problem in the `ToByteSlice`, which should not allow `bool` to be used there. I have concrete ideas to solve this.




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