alamb commented on PR #12318:
URL: https://github.com/apache/arrow-rs/pull/12318#issuecomment-7111396117

   > > I didn't explore the possibility of `Array::slice` as a starting point 
before
   > 
   > A few observation as I dust off memories:
   > 
   > 1. [No way to downcast Arc<dyn Array> to Arc<T: Array> 
#8794](https://github.com/apache/arrow-rs/issues/8794) is specifically trying 
to recover an `Arc<T: Array>` from `Arc<dyn Array>` _without cloning_ (a 
downcast of sorts), which is a different problem than `Array::to_arc` would 
solve.
   > 2. If we're ok with cloning, then we don't even need to start from 
`Array::slice`. Every in-tree `T: Array` is also `T: Clone`, so `to_arc` for 
all the concrete array types is just `Arc::new(self.clone())`. If we wanted a 
provided `to_arc` so the new method isn't a breaking change, that would have to 
delegate to `Array::slice` because we don't require `Array: Clone`.
   
   I was mostly thinking that the key usecase is a function that takes `&dyn 
Array` or `&dyn Datum` as input but whose signature must return an `Arc<&dyn 
Array>` (aka ArrayRef)  as is the case here. Ideally that process would only 
require a single Arc increment rather than `slice` or cloneing


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