mbutrovich opened a new issue, #7755:
URL: https://github.com/apache/datafusion-comet/issues/7755

   ### What is the problem the feature request solves?
   
   arrow-rs adds `Array::to_arc` in apache/arrow-rs#12420, and it is expected 
to ship in arrow 60.3.0 or 61.0.0. It returns an `ArrayRef` that shares the 
buffers of a `&dyn Array`. When the `&dyn Array` is an `&ArrayRef`, it returns 
a new reference to the same allocation.
   
   Comet turns a `&dyn Array` into an `ArrayRef` with a workaround in two 
places:
   
   - `make_array(array.to_data())` in `unpack_dictionary`, for inputs that 
aren't dictionary encoded: 
https://github.com/apache/datafusion-comet/blob/f141d9010e89423f5e0387d2e9e1990e3c4b684b/native/spark-expr/src/kernels/temporal.rs#L1253-L1259
   - `input.slice(0, input.len())` in the `extrema` test helper: 
https://github.com/apache/datafusion-comet/blob/f141d9010e89423f5e0387d2e9e1990e3c4b684b/native/spark-expr/src/array_funcs/array_extrema/tests.rs#L46-L48
   
   `make_array(x.to_data())` builds an `ArrayData` and then rebuilds a typed 
array from it. `slice(0, len)` recounts the null buffer's nulls. `to_arc` 
clones an arrow-rs array into a new `Arc`, and for an `ArrayRef` it only 
increments the reference count.
   
   ### Describe the potential solution
   
   After Comet upgrades to an arrow release that includes `Array::to_arc`, 
replace both workarounds with `x.to_arc()`. Comet's `native/Cargo.toml` depends 
on arrow 59.2.0 today, so this waits for that upgrade.
   
   ### Additional context
   
   The same arrow-rs PR switches arrow's own `cast`, `concat`, `nullif`, and 
`shift` from these workarounds to `to_arc`.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to