You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Wes McKinney (Jira)" <ji...@apache.org> on 2020/06/18 00:00:00 UTC
[jira] [Commented] (ARROW-9161) [C++][Compute] Formalize Op functor
concept
[ https://issues.apache.org/jira/browse/ARROW-9161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17138909#comment-17138909 ]
Wes McKinney commented on ARROW-9161:
-------------------------------------
There are several recurring concepts:
* **What are usually called "Op" in templates**. These are functors that have a "Call" function that processes a single element of data
* **Functors that I would call "applicators"**. These take an "Op" along with the dependent types (e.g. the input and output types) and produce a class that has an "Exec" function that can be used for an {{ArrayKernel::exec}} member. Examples include {{codegen::ScalarUnary}}
For example, ScalarBinary looks like this:
{code}
template <typename OutType, typename Arg0Type, typename Arg1Type, typename Op>
struct ScalarBinary {
{code}
The way to interpret this is: this is an applicator that takes 3 dependent types and an Op functor providing the operation to be applied to the elements of the input data
Perhaps we could call this "BinaryApplicator" or something.
Finally, we have what I'm calling "generator-dispatchers". These cause the applicator templates to be instantiated and for the caller to select one of the instantiated templates dynamically without using macros.
I'm currently renaming the generator-dispatchers for clarity in https://github.com/apache/arrow/pull/7461
> [C++][Compute] Formalize Op functor concept
> -------------------------------------------
>
> Key: ARROW-9161
> URL: https://issues.apache.org/jira/browse/ARROW-9161
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++
> Affects Versions: 0.17.1
> Reporter: Ben Kietzman
> Priority: Major
> Fix For: 2.0.0
>
>
> The compute namespace makes extensive use of functors for generating kernel implementations. These are named {{Op}}, {{Generator}}, and functors. It would improve readability of the compute namespace if we formalized the concept and named instances consistently and made clear what functions they're expected to provide.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)