liamzwbao commented on code in PR #9503:
URL: https://github.com/apache/arrow-rs/pull/9503#discussion_r2971947238


##########
arrow-json/src/reader/list_array.rs:
##########
@@ -88,18 +93,30 @@ impl<O: OffsetSizeTrait> ArrayDecoder for 
ListArrayDecoder<O> {
             let offset = O::from_usize(child_pos.len()).ok_or_else(|| {
                 ArrowError::JsonError(format!("offset overflow decoding {}", 
self.data_type))
             })?;
-            offsets.append(offset)
+            offsets.push(offset);
         }
 
         let child_data = self.decoder.decode(tape, &child_pos)?;
         let nulls = nulls.as_mut().map(|x| NullBuffer::new(x.finish()));
 
-        let data = ArrayDataBuilder::new(self.data_type.clone())
+        let mut data = ArrayDataBuilder::new(self.data_type.clone())
             .len(pos.len())
             .nulls(nulls)
-            .add_buffer(offsets.finish())
             .child_data(vec![child_data]);
 
+        if IS_VIEW {

Review Comment:
   We could calculate the size on the fly, but I would prefer calculating here 
and keeping the main loop clean. This implementation follows the same thought 
as the variant_to_arrow list builder: 
https://github.com/apache/arrow-rs/blob/70445c54ff510e1b9f8d6e6782b92a1ce45fbb28/parquet-variant-compute/src/variant_to_arrow.rs#L973-L996



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