Skip to content
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

JSON: write struct array nulls as null #5133

Merged
merged 5 commits into from
Nov 28, 2023

Conversation

Jefffrey
Copy link
Contributor

Which issue does this PR close?

Closes #5066

Rationale for this change

What changes are included in this PR?

Nulls in struct arrays are written as null in JSON, where previously was written as {} (or filled with nulls for the keys if explicit nulls are written)

Are there any user-facing changes?

@github-actions github-actions bot added the arrow Changes to the arrow crate label Nov 28, 2023
Copy link
Contributor

@tustvold tustvold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, just some minor nits

arrow-json/src/writer.rs Outdated Show resolved Hide resolved
let json_values = jsonmaps
.into_iter()
.map(|maybe_map| {
if let Some(map) = maybe_map {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A match might be nicer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored to use map and unwrap_or

Jefffrey and others added 2 commits November 29, 2023 07:46
Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com>
@tustvold tustvold merged commit ef6932f into apache:master Nov 28, 2023
23 checks passed
@Jefffrey Jefffrey deleted the json_write_struct_array_nulls branch November 29, 2023 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON writer - write null structs as null, instead of struct with nulls
2 participants