hi Uwe,

For Contains, wouldn't you want to make the kernel binary so that the
"match" argument can be data-varying (e.g. it can be an Array, too)?

Aside from that, the way to pass static data to the kernel is through
an options. So you would do

struct MyArg : public FunctionOptions {
  std::string value;
};

Then in the kernel implementation, you define:

using MyFuncState = OptionsWrapper<MyArg>;

and then set the kernel's init function to

kernel.init = InitWrapOptions<MyArg>;

So then your arg can be accessed wherever you have a KernelContext* with

MyArg arg = checked_cast<const MyFuncState&>(*ctx->state()).options;

This process could likely be simplified with some helper templates or macros

- Wes

On Wed, Jun 17, 2020 at 4:23 AM Uwe L. Korn <u...@apache.org> wrote:
>
> Hello all,
>
> I'm trying to implement a `contains` kernel that takes as an input a 
> StringArray and a scalar string (see 
> https://issues.apache.org/jira/browse/ARROW-9160). I feel confident with the 
> rest of the new Kernels setup but I didn't find an example kernel where we 
> also pass in a scalar attribute. Can someone point me to an approach on how 
> to do this?
>
> Best
> Uwe

Reply via email to