I did a bit more research on JIRA and we seem to have this open topic there also in https://issues.apache.org/jira/browse/ARROW-6959 which is the similar topic as my mail is about and in https://issues.apache.org/jira/browse/ARROW-7009 we wanted to remove some of the interfaces with reference-types.
On Tue, Apr 7, 2020, at 1:00 PM, Uwe L. Korn wrote: > Hello all, > > I'm in the progress of changing the implementation of the Take kernel > to work on ChunkedArrays without concatenating them into a single Array > first. While working on the implementation, I realised that we switch > often between Datum and the specific-typed parameters. This works quite > well for the combination of Array& and Datum(shared_ptr<ArrayData>) as > here the reference object with type Array& always carries a shared > reference with it, so switching between Array& and its Datum is quite > easy. > > In contrast, we cannot do this with ChunkedArrays as here the Datum > requires a shared_ptr<ChunkedArray> which cannot be constructed from > the reference type. Thus to allow interfaces like `Status > Take(FunctionContext* ctx, const ChunkedArray& values, const Array& > indices,` to pass successfully their arguments to the Kernel > implementation, we have to do: > > a) Remove the references from the interface of the Take() function and > use `shared_ptr` instances everywhere. > b) Add interfaces to kernels like the TakeKernel that allow calling > with specific references instead of Datum instances > > Personally I would prefer b) as this allow us to make more use of the > C++ type system and would also avoid the shared_ptr overhead where not > necessary. > > Cheers, > Uwe >