Skip to content

add compute kernels that operate on ArrayRef -- e.g eq_dyn #843

@alamb

Description

@alamb

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I want to compare two ArrayRefs (Arc<Array>) with each other

Arrow offers compute kernels for primitive (numeric) types(e.g. eq), and separate ones for string types (e.g. eq_utf8).
https://docs.rs/arrow/6.0.0/arrow/compute/kernels/comparison/index.html

This means I have to match on the datatype and then dispatch to the appropriate implementation

You can see a bunch of this kind of dispatch (encoded in macros) in Datafusion, for example https://github.com/apache/arrow-datafusion/blob/81fae230b81b97e93bbb95b284cfda6f4d59552e/datafusion/src/physical_plan/expressions/binary.rs#L289-L328

Describe the solution you'd like
Add functions like OP_dyn that did the type dispatch within arrow

So for example, a function like this:

/// Compare the left and right arrays for equality. Returns an error if they are not the exact same type
fn eq_dyn(left: &dyn Array, right: &dyn Array) -> result<BooleanArray> {
  // switch on types and call appropriate eq kernel
...
}

and neq_dyn, lt_dyn, etc.

Describe alternatives you've considered
Leave it as is

Additional context
See also apache/datafusion#1163 and #842

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrowChanges to the arrow crateenhancementAny new improvement worthy of a entry in the changelog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions