alamb commented on code in PR #8177:
URL: https://github.com/apache/arrow-rs/pull/8177#discussion_r2289309928
##########
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:
I think object is the more expected result
Maybe you can all the keys of the `MapArray` into strings using the
`cast_to_variant` kernel ?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]