mbutrovich opened a new issue, #27687: URL: https://github.com/apache/datafusion/issues/27687
### Is your feature request related to a problem or challenge? 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. DataFusion has four places outside tests that turn a `&dyn Array` into an `ArrayRef` with a workaround: - `make_array(array.to_data())` in `normalize_nested_float_zero`: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-expr-common/src/datum.rs#L128-L131 - `make_array(v.to_data())` in `ArrayStaticFilter::contains`: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-expr/src/expressions/in_list/array_static_filter.rs#L132 - `truthy.slice(0, truthy.len())` in the all-true fast path of `scatter`: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-expr-common/src/utils.rs#L80-L82 - `make_array(dictionary.keys().to_data())` in `ColumnSize::new`: https://github.com/apache/datafusion/blob/dbb98dedc329a296a5153019b5ccfdf260088c3f/datafusion/physical-plan/src/spill/spilled_row_sizes.rs#L158 `make_array(x.to_data())` builds an `ArrayData` and then rebuilds a typed array from it, and nested types repeat that for every child. `slice(0, len)` recounts the null buffer's nulls and re-slices the children of nested types. `to_arc` clones an arrow-rs array into a new `Arc`, and for an `ArrayRef` it only increments the reference count. ### Describe the solution you'd like After DataFusion upgrades to an arrow release that includes `Array::to_arc`, replace each workaround above with `x.to_arc()`. ### Describe alternatives you've considered We could keep the workarounds. They return equal arrays but do more work per call. ### 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]
