alamb commented on code in PR #8177:
URL: https://github.com/apache/arrow-rs/pull/8177#discussion_r2289010712


##########
parquet-variant-compute/src/cast_to_variant.rs:
##########
@@ -1820,6 +1860,53 @@ mod tests {
         );
     }
 
+    #[test]
+    fn test_cast_map_to_variant_object() {
+        let keys = vec!["key1", "key2", "key3"];
+        let values_data = Int32Array::from(vec![1, 2, 3]);
+        let entry_offsets = vec![0, 1, 1, 3];
+        let map_array =
+            MapArray::new_from_strings(keys.clone().into_iter(), &values_data, 
&entry_offsets)
+                .unwrap();
+
+        let result = cast_to_variant(&map_array).unwrap();
+        // [{"key1":1}]
+        let variant1 = result.value(0);
+        let item = variant1.as_list().unwrap().get(0).unwrap();
+        assert_eq!(
+            item.as_object().unwrap().get("keys").unwrap(),

Review Comment:
   This seems to have created something like
   ```json
   [{ 
     "keys": "key1",
     "values": 1
   }]
   ```
   
   I expect the result to be
   ```json
   { "key1": 1 }
   ```
   
   Questions:
   1. where did the list come from?
   2. I am not sure about the "keys" and "values" fields 🤔 
   



-- 
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-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to