Jefffrey commented on code in PR #9496:
URL: https://github.com/apache/arrow-rs/pull/9496#discussion_r3813473455
##########
arrow-json/src/reader/mod.rs:
##########
@@ -313,6 +317,25 @@ impl ReaderBuilder {
..self
}
}
+ /// Sets whether to flatten top-level arrays.
+ ///
+ /// * When `true`, each element of a top-level array will be treated as
its own row.
+ /// * When `false` (the default), the entire top-level array will be
treated as one row.
+ ///
+ /// For example, consider this input file:
+ /// ```text
+ /// [{ "a": 1 }, { "a": 2 }, { "b": 3 }]
+ /// [{ "a": 4 }, { "a": 5 }, { "b": 6 }]
+ /// ```
+ ///
+ /// By default, this would be parsed as two rows, each an array containing
three elements.
+ /// With this option set to `true`, however, this would be parsed as six
rows.
+ pub fn with_flatten(self, flatten_top_level_arrays: bool) -> Self {
Review Comment:
should we also mention it doesnt enforce this, so it can allow mixed lists &
objects (as per the test case) or would this be implied anyway
##########
arrow-json/src/reader/tape.rs:
##########
@@ -242,6 +249,7 @@ enum DecoderState {
impl DecoderState {
fn as_str(&self) -> &'static str {
match self {
+ DecoderState::TopLevelList => "list",
Review Comment:
do we need to give this a distinct name from `list`?
##########
arrow-json/src/reader/mod.rs:
##########
@@ -181,12 +181,14 @@ mod tape;
mod timestamp_array;
/// A builder for [`Reader`] and [`Decoder`]
+#[derive(Clone)]
Review Comment:
its probably fine to derive clone for this 👍
--
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]