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/12 16:41:27 UTC

[GitHub] [arrow-rs] viirya commented on a diff in pull request #1550: Fix reading dictionaries from nested structs in ipc `StreamReader`

viirya commented on code in PR #1550:
URL: https://github.com/apache/arrow-rs/pull/1550#discussion_r848648354


##########
arrow/src/ipc/reader.rs:
##########
@@ -1394,4 +1407,36 @@ mod tests {
         let arrow_json: ArrowJson = serde_json::from_str(&s).unwrap();
         arrow_json
     }
+
+    #[test]
+    fn test_roundtrip_stream_nested_dict() {
+        let xs = vec!["AA", "BB", "AA", "CC", "BB"];
+        let dict = Arc::new(
+            xs.clone()
+                .into_iter()
+                .collect::<DictionaryArray<datatypes::Int8Type>>(),
+        );
+        let string_array: ArrayRef = Arc::new(StringArray::from(xs.clone()));
+        let struct_array = StructArray::from(vec![
+            (Field::new("f1.1", DataType::Utf8, false), string_array),
+            (
+                Field::new("f1.2_struct", dict.data_type().clone(), false),
+                dict.clone() as ArrayRef,
+            ),

Review Comment:
   nit: as they are put under `f2_struct`, I guess `f2.1` and `f2.2_struct` look more appropriate?



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