chenkovsky commented on issue #15205:
URL: https://github.com/apache/datafusion/issues/15205#issuecomment-2731509381

   Hi, @Dandandan . 
   
   it seems that there's no direct way to deep copy array in arrow?
   so I tested the following code. it seems that it works.
   
   ```rust
   let a = array.slice(index, 1);
   
   // copy
   let data = a.to_data();
   let mut copy = MutableArrayData::new(vec![&data], true, data.len());
   copy.extend(0, 0, data.len());
   let a = make_array(copy.freeze());
   
   Self::Struct(Arc::new(a.as_struct().to_owned()))
   ```
   
   But I'm wondering whether it's better to provide a deep copy method for 
ScalarValue rather than modify try_from_array. 
   then we can just copy the scalar value when it's needed since deep copy is 
expensive.
   
   
   
   


-- 
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-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to