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 2020/12/06 12:08:52 UTC

[GitHub] [arrow] alamb commented on a change in pull request #8852: ARROW-10826: [Rust] Add support for FixedSizeBinaryArray to MutableArrayData

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



##########
File path: rust/arrow/src/array/transform/mod.rs
##########
@@ -687,4 +690,24 @@ mod tests {
         let expected = Int16Array::from(vec![Some(1), None]);
         assert_eq!(result.keys(), &expected);
     }
+
+    #[test]
+    fn test_binary_fixed_sized_offsets() {
+        let array =
+            FixedSizeBinaryArray::from(vec![vec![0, 0], vec![0, 1], vec![0, 2]]).data();
+        let array = array.slice(1, 2);
+
+        let arrays = vec![&array];
+
+        let mut mutable = MutableArrayData::new(arrays, false, 0);
+
+        mutable.extend(0, 1, 2);
+        mutable.extend(0, 0, 1);
+
+        let result = mutable.freeze();
+        let result = FixedSizeBinaryArray::from(Arc::new(result));
+
+        let expected = FixedSizeBinaryArray::from(vec![vec![0, 2], vec![0, 1]]);

Review comment:
       I am having trouble figuring out why this is the expected output. I expected something like
   
   ```
           let expected = FixedSizeBinaryArray::from(vec![vec![0, 1], vec![0, 0]]);
   ```
   
   As I read 
   
   ```
           mutable.extend(0, 1, 2); // --> pick element 1 (aka vec[0, 1])
           mutable.extend(0, 0, 1); // --> pick element 0 (aka vec[0, 0])
   ```




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