hareshkh opened a new pull request, #10670:
URL: https://github.com/apache/arrow-rs/pull/10670
# Which issue does this PR close?
- Related: #9021, #9272 (prior art, both went stale); a step toward #8987
but does not close it.
# Rationale for this change
- The JSON writer has been extensible since #7015 (`EncoderFactory`, plus a
public `make_encoder` to delegate to defaults). The reader has no equivalent.
- Small now because #9272's prefactors already merged (#9266, #9270, #9271):
`DecoderContext` sits on `main` as public-but-inert API.
On exposing the tape, the one substantive objection on #9272:
- `mod tape` stays private - only `Tape`/`TapeElement` are re-exported, so
`TapeDecoder` stays internal and downstream can never construct a `Tape`.
- `TapeElement` is `#[non_exhaustive]`, so the encoding can change. Aimed at
#9329: skipping discarded values won't break downstream matches.
- #3629 is unaffected - it changes tape *production*, which stays private.
# What changes are included in this PR?
- `TapeElement` `#[non_exhaustive]`, documenting numbers as `Number` (JSON
text) or native `i32`/`i64`/`f32`/`f64` (serde path), 64-bit spanning two
elements.
- `ArrayDecoder` public; `pos` holds one tape index per output row.
- New `DecoderFactory`, consulted before the reader's dispatch; `Ok(None)`
accepts the default.
- `DecoderContext::make_decoder` public, so a factory can delegate to the
decoder the reader would otherwise use - without it, overriding a nested type
means reimplementing its children (@scovich's point on #9021).
- `ReaderBuilder::with_decoder_factory`.
# Are these changes tested?
Yes. Unit tests and a doctest decoding `Binary` from a JSON int array - the
inverse of the existing `EncoderFactory` doctest, so the two round-trip, no new
dependency.
# Are there any user-facing changes?
New: `arrow_json::{Tape, TapeElement, ArrayDecoder, DecoderFactory}`,
`DecoderContext::{make_decoder, decoder_factory}`,
`ReaderBuilder::with_decoder_factory`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]