Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
now Array trait only support as_any
arrow-rs/arrow-array/src/array/mod.rs
Lines 72 to 106 in 9728c67
When I implementing using copy on write to evaluate col_x+1
binary_expr,
I need cast ArrayRef
to PrimitiveArray
with ownership and with strong reference one😩 then pass to unary_mut
.
arrow-rs/arrow-arith/src/arity.rs
Lines 59 to 65 in 26ea71c
So i decide using downcast_mut
then use mem::take()
get the array: PrimitiveArray<I>,
But there no as_any_mut
, so i try to add this func 🤔.
Seems there already one in ArrayBuilder
arrow-rs/arrow-array/src/builder/mod.rs
Line 129 in f0be9da
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Activity
Ted-Jiang commentedon Feb 3, 2023
@tustvold @alamb Plz help take a look 😄
tustvold commentedon Feb 3, 2023
Why not use https://docs.rs/arrow-array/latest/arrow_array/cast/fn.downcast_array.html, this would avoid needing to use take
alamb commentedon Feb 3, 2023
I think this is a similar ask to #2901
There is somewhat of a workaround listed #2901 (comment)
I wonder if that would work?
Ted-Jiang commentedon Feb 3, 2023
seems both solution use
T::from(array.data().clone())
will +1 toarray.data()
strong reference.tustvold commentedon Feb 3, 2023
Provided you then proceed to drop the
ArrayRef
that is fine? FWIW you will have the same problem withdowncast_mut