Weijun-H commented on code in PR #8177: URL: https://github.com/apache/arrow-rs/pull/8177#discussion_r2289232240
########## 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: Since there is no data type in `Variant` that can directly represent a map, I converted the map into the following structure: ``` [ { "keys": "key1", "values": 1 }, { "keys": "key2", "values": 2 } ] ``` Using an object might be a better idea, but the keys can only be strings. 🤔 -- 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