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 2022/04/19 09:33:14 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #1583: Read/write nested dictionary under map in ipc stream reader/writer

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


##########
arrow/src/ipc/reader.rs:
##########
@@ -1481,4 +1481,55 @@ mod tests {
         let output_batch = roundtrip_ipc_stream(&input_batch);
         assert_eq!(input_batch, output_batch);
     }
+
+    #[test]
+    fn test_roundtrip_stream_nested_dict_dict_in_map() {
+        let values = StringArray::from_iter_values(["a", "b", "c"]);
+        let keys = Int8Array::from_iter_values([0, 0, 1, 2, 0, 1]);
+        let dict_array = DictionaryArray::<Int8Type>::try_new(&keys, &values).unwrap();
+
+        let keys_array = Int32Array::from_iter_values([0, 0, 1, 2, 0, 1]);
+        let keys_field = Field::new("keys", DataType::Int32, false);
+        let values_field = Field::new_dict(
+            "values",
+            DataType::Dictionary(Box::new(DataType::Int8), Box::new(DataType::Utf8)),
+            false,

Review Comment:
   Could also test some NULLs



##########
arrow/src/ipc/reader.rs:
##########
@@ -1481,4 +1481,55 @@ mod tests {
         let output_batch = roundtrip_ipc_stream(&input_batch);
         assert_eq!(input_batch, output_batch);
     }
+
+    #[test]
+    fn test_roundtrip_stream_nested_dict_dict_in_map() {
+        let values = StringArray::from_iter_values(["a", "b", "c"]);
+        let keys = Int8Array::from_iter_values([0, 0, 1, 2, 0, 1]);
+        let dict_array = DictionaryArray::<Int8Type>::try_new(&keys, &values).unwrap();
+
+        let keys_array = Int32Array::from_iter_values([0, 0, 1, 2, 0, 1]);
+        let keys_field = Field::new("keys", DataType::Int32, false);

Review Comment:
   Might want to test dictionary encoded keys as well



##########
arrow/src/ipc/reader.rs:
##########
@@ -1481,4 +1481,55 @@ mod tests {
         let output_batch = roundtrip_ipc_stream(&input_batch);
         assert_eq!(input_batch, output_batch);
     }
+
+    #[test]
+    fn test_roundtrip_stream_nested_dict_dict_in_map() {

Review Comment:
   ```suggestion
       fn test_roundtrip_stream_nested_dict_of_map_of_dict() {
   ```



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