You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2026/08/27 19:20:07 UTC

[PR] Document how to customize JSON decoding via `DecoderFactory` [arrow-rs]

alamb opened a new pull request, #10897:
URL: https://github.com/apache/arrow-rs/pull/10897

   # Which issue does this PR close?
   
   N/A -- documentation only.
   
   **Stacked on #10670** (draft until that merges; only the last commit is new -- see the doc-only diff [here](https://github.com/apache/arrow-rs/compare/hareshkh:json-decoder-factory...alamb:document-json-decoder-factory)).
   
   # Rationale for this change
   
   #10670 adds the ability to customize JSON decoding via [`DecoderFactory`], but neither the crate-level docs nor the reader module docs mention it, so users would only find the hook by stumbling on `ReaderBuilder::with_decoder_factory`.
   
   This adds the matching pointers for *decoding* that #10741 added for *encoding*, as anticipated in that PR's description.
   
   [`DecoderFactory`]: https://github.com/apache/arrow-rs/pull/10670
   
   # What changes are included in this PR?
   
   Documentation only, no code changes:
   - Crate-level docs: list a custom `DecoderFactory` as an alternative for binary data decoding, alongside the existing `EncoderFactory` pointer
   - Reader module docs: new "Customizing the decoder" section, mirroring the writer's "Customizing the encoder" section
   
   # Are these changes tested?
   
   Covered by existing doc tests and CI rustdoc link checking.
   
   # Are there any user-facing changes?
   
   Documentation only.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Document how to customize JSON decoding via `DecoderFactory` [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10897:
URL: https://github.com/apache/arrow-rs/pull/10897#discussion_r3913546693


##########
arrow-json/src/reader/mod.rs:
##########
@@ -49,11 +49,11 @@
 //!
 //! # Async Usage
 //!
-//! The lower-level [`Decoder`] can be integrated with various forms of async data streams,
-//! and is designed to be agnostic to the various different kinds of async IO primitives found
+//! The lower-level [`Decoder`] can be integrated with various forms of async

Review Comment:
   drive by to make the text clearer



##########
arrow-json/src/reader/mod.rs:
##########
@@ -132,6 +132,14 @@
 //! }
 //! ```
 //!
+//! # Customizing the decoder

Review Comment:
   This is the main purpose of this PR: leave a note here about how to customize the decoder



##########
arrow-json/src/writer/encoder.rs:
##########
@@ -149,8 +149,13 @@ impl EncoderOptions {
 ///
 /// [`WriterBuilder::with_encoder_factory`]: crate::writer::WriterBuilder::with_encoder_factory
 ///
-/// # Examples
+/// # Example: Encode a `BinaryArray` as an array of integers

Review Comment:
   I tried to make the examples here a little clearer and added some more explanatory docs



##########
arrow-json/src/lib.rs:
##########
@@ -29,11 +29,13 @@
 //! Note that `Base16` only has 50% space efficiency (i.e., the encoded data is twice as large
 //! as the original). If that is an issue, there are two alternatives:
 //!
-//! 1. Provide a custom encoder. See the [Customizing the encoder] section of the writer documentation.
+//! 1. Provide a custom encoder and/or decoder. See the [Customizing the encoder] section of the
+//!    writer documentation and the [Customizing the decoder] section of the reader documentation.
 //! 2. Convert binary data to/from a different encoding format such as `Base64` before
 //!    writing / after reading, as shown in the following example.
 //!
 //! [Customizing the encoder]: writer#customizing-the-encoder
+//! [Customizing the decoder]: reader#customizing-the-decoder

Review Comment:
   here is the main entry to help people find the new feature



##########
arrow-json/src/reader/mod.rs:
##########
@@ -766,9 +775,11 @@ pub trait ArrayDecoder: Send {
 /// handle. The reader-side counterpart of [`EncoderFactory`]; register an
 /// implementation with [`ReaderBuilder::with_decoder_factory`].
 ///
-/// # Examples
+/// # Example: Decode `Binary` from a JSON array of integers

Review Comment:
   The example originally showed how to use the decoder factory as well as switch on the extension type. I think it would be clearer to have separate examples, so I split it into two examples and added some comments



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Document how to customize JSON decoding via `DecoderFactory` [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #10897:
URL: https://github.com/apache/arrow-rs/pull/10897#issuecomment-5808565260

   thanks all


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Document how to customize JSON decoding via `DecoderFactory` [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey merged PR #10897:
URL: https://github.com/apache/arrow-rs/pull/10897


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Document how to customize JSON decoding via `DecoderFactory` [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10897:
URL: https://github.com/apache/arrow-rs/pull/10897#issuecomment-5819633444

   Thank you @Jefffrey 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org