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


##########
arrow-json/src/reader/mod.rs:
##########
@@ -295,16 +296,15 @@ impl ReaderBuilder {
 
     /// Create a [`Decoder`]
     pub fn build_decoder(self) -> Result<Decoder, ArrowError> {
-        let (data_type, nullable) = match self.is_field {
-            false => (DataType::Struct(self.schema.fields.clone()), false),
-            true => {
-                let field = &self.schema.fields[0];
-                (field.data_type().clone(), field.is_nullable())
-            }
+        let (data_type, nullable) = if self.is_field {
+            let field = &self.schema.fields[0];
+            (Cow::Borrowed(field.data_type()), field.is_nullable())

Review Comment:
   NOTE: This `Cow::Borrowed` is necessary to preserve pointer stability of 
`field.data_type()` that would otherwise have to be cloned.



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