alamb opened a new pull request #9575:
URL: https://github.com/apache/arrow/pull/9575
## Rationale
Currently the Arrow json writer makes JSON that looks like this (one record
per line):
```json
{"foo":1}
{"bar":1}
```
Which is not technically valid JSON, which would look something like this:
```
[
{"foo":1},
{"bar":1}
]
```
## New Features
This PR parameterizes the JSON writer so it can write in either format. Note
I needed this feature for in IOx, in
https://github.com/influxdata/influxdb_iox/pull/870, and I want to propose
contributing it back here).
## Other Changes:
1. Added the function `into_inner()` to retrieve the inner writer from the
JSON writer, following the model of the Rust standard library (e.g.
[BufReader::into_inner](https://doc.rust-lang.org/std/io/struct.BufReader.html#method.into_inner)
2. Per Rust standard pattern, I change the JSON writer so that it doesn't
add any Buffering (via `BufReader`) itself, and instead allows the caller the
choice of what type of buffering, if any, is needed.
3. Added / cleaned up a bunch of documentation and comments.
## Questions
I went with parameterizing the `Writer` output as a trait rather than
runtime dispatch, for performance. This shouldn't have backwards compatible
issues Given the writer has not yet been released yet (introduced by @houqp
https://github.com/apache/arrow/pull/9256)
However would people prefer a single `Writer` that took an `Options` struct
or something to determine how it wrote out data?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]