You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/08/03 05:39:23 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4625: fix: compute_dictionary_mapping use wrong offsetSize

tustvold commented on code in PR #4625:
URL: https://github.com/apache/arrow-rs/pull/4625#discussion_r1282668460


##########
arrow-row/src/lib.rs:
##########
@@ -2442,4 +2442,25 @@ mod tests {
             assert_eq!(&back[0], &array);
         }
     }
+
+    #[test]
+    fn test_append_codec_dictionary_binary() {
+        use DataType::*;
+        // Dictionary RowConverter
+        let mut converter = RowConverter::new(vec![SortField::new(Dictionary(
+            Box::new(Int8),
+            Box::new(Binary),
+        ))])
+        .unwrap();
+        let mut rows = converter.empty_rows(3, 128);
+
+        let keys = Int8Array::from_iter_values([0, 0, 1, 2]);
+        let values = BinaryArray::from(vec![None, Some("a".as_bytes()), Some(b"b")]);
+        let dict_array = DictionaryArray::new(keys, Arc::new(values));
+
+        rows.clear();
+        let array = Arc::new(dict_array) as ArrayRef;
+        converter.append(&mut rows, &[array.clone()]).unwrap();
+        converter.convert_rows(&rows).unwrap();

Review Comment:
   ```suggestion
           let back = converter.convert_rows(&rows).unwrap();
           assert_eq!(back.as_ref(), array):
   ```
   



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