-
Notifications
You must be signed in to change notification settings - Fork 810
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
Allow writing null valued keys in JSON #5065
Conversation
As commented on the ticket, the current behaviour is simply incorrect as it will not survive a round-trip. I therefore don't think there is a need to make the prior logic configurable, which I think should simplify this PR |
If you're referring to #5066 then that is a separate issue which this PR doesn't cover. |
Aah I see, in that case is there a way we could make this an option instead of a generic. As it stands this is a breaking change, which I'm not sure about |
Can you give an example where this might break existing uses? I thought including a default for the new generic parameter for |
I could be mistaken but i thought adding new parameters was always a breaking change. Regardless using generics here will result in additional codegen and I'm doubtful will improve performance. Adding a WriterOptions or similar should be more future proof and more consistent with other implementations |
Yeah that makes 👍 I'll work on switching to such |
Removed configuring this null behaviour as a generic trait, and changed to be a config that can be set via a new WriterBuilder (akin to arrow-csv writing behaviour) |
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.
This looks good to me, my only comment is I think it should be keep_null_values
or possibly preserve_nulls
, as null keys are actually illegal in JSON 😅
Yeah I wasn't sure on the proper name. I was gonna leave it as Maybe something like |
Perhaps explicit_nulls ? |
Sounds better, renamed to that 👍 |
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.
Looks good to me, thank you
Which issue does this PR close?
Closes #3774
Rationale for this change
Allow users to write JSON with null values for keys, where previous (and default) is to skip the keys.
What changes are included in this PR?
In arrow-json writer mod, new builder for
Writer
which allows configuring how null valued keys (and null arrays) should be handled. Will default to skipping keys with null values for backward compatibility.Are there any user-facing changes?
Yes