scovich commented on code in PR #9271:
URL: https://github.com/apache/arrow-rs/pull/9271#discussion_r2729222063


##########
arrow-json/src/reader/struct_array.rs:
##########
@@ -80,42 +80,35 @@ pub struct StructArrayDecoder {
 
 impl StructArrayDecoder {
     pub fn new(
+        ctx: &DecoderContext,
         data_type: DataType,
-        coerce_primitive: bool,
-        strict_mode: bool,
         is_nullable: bool,
-        struct_mode: StructMode,
     ) -> Result<Self, ArrowError> {
-        let (decoders, field_name_to_index) = {
-            let fields = struct_fields(&data_type);
-            let decoders = fields
-                .iter()
-                .map(|f| {
-                    // If this struct nullable, need to permit nullability in 
child array
-                    // StructArrayDecoder::decode verifies that if the child 
is not nullable
-                    // it doesn't contain any nulls not masked by its parent
-                    let nullable = f.is_nullable() || is_nullable;
-                    make_decoder(
-                        f.data_type().clone(),
-                        coerce_primitive,
-                        strict_mode,
-                        nullable,
-                        struct_mode,
-                    )
-                })
-                .collect::<Result<Vec<_>, ArrowError>>()?;
-            let field_name_to_index = if struct_mode == StructMode::ObjectOnly 
{
-                build_field_index(fields)
-            } else {
-                None
-            };
-            (decoders, field_name_to_index)
+        let struct_mode = ctx.struct_mode();
+        let fields = struct_fields(&data_type);
+
+        let mut decoders = Vec::with_capacity(fields.len());
+        for field in fields {
+            // If this struct nullable, need to permit nullability in child 
array
+            // StructArrayDecoder::decode verifies that if the child is not 
nullable

Review Comment:
   If this comment shows up as part of the diff, change to "ignore whitespace" 
in settings for an easier review.



-- 
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]

Reply via email to