-
Notifications
You must be signed in to change notification settings - Fork 855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for MapArray
in json writer
#1149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @helgikrs -- looks good to me
|
||
// Keys have to be strings to convert to json. | ||
if !matches!(keys.data_type(), DataType::Utf8) { | ||
panic!("Unsupported datatype: {:#?}", array.data_type()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be much nicer if this code did not panic
when there was an unsupported datatype. However, I see that the the signature for set_column_for_json_rows
does not return a Result 😢
I'll file a follow on ticket and see if someone in the community is interesting in improving this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false, | ||
); | ||
|
||
// [{"foo": 10}, null, {}, {"bar": 20, "baz": 30, "qux": 40}, {"quux": 50}, {}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to have a better / nicer way to contruct MapArrays
-- again not for this PR but eventually it would be nice to have something like
https://docs.rs/arrow/6.5.0/arrow/array/struct.StructArray.html
I will file another ticket
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @helgikrs |
MapArray
in json writer
Which issue does this PR close?
This PR adds map arrays into the json writer, tracked by #538.
What changes are included in this PR?
This PR adds support for writing map arrays to json and a new test for this functionality in the json writer.
Are there any user-facing changes?
Adds a new public function,
as_map_array
, toarrow::array::cast
.