The closest I can find seems to be the index from ComputeFunction:
https://arrow.apache.org/docs/python/api/compute.html
But I do not find a working code example for it in C++ from the apache arrow codebase.
The closest I can find seems to be the index from ComputeFunction:
https://arrow.apache.org/docs/python/api/compute.html
But I do not find a working code example for it in C++ from the apache arrow codebase.
Here's the documentation for that function in the cpp docs:
https://arrow.apache.org/docs/cpp/compute.html#aggregations
And here's a short example of how to call the function in C++:
8.0.0: https://github.com/apache/arrow/blob/apache-arrow-8.0.0/cpp/src/arrow/compute/kernels/aggregate_test.cc#L2234
7.0.0: https://github.com/apache/arrow/blob/apache-arrow-7.0.0/cpp/src/arrow/compute/kernels/aggregate_test.cc#L2206
[2022-05-23 Edit]
Here is an example that calls the Index function, using arrow 7.0.0:
https://github.com/drin/cookbooks/blob/mainline/arrow/compute-api/recipe.cpp#L18
The recipe.hpp file should show the required includes and types that are used (I tried to minimize to just what's necessary).
Also, here is corresponding code for usage, including making some test data and using the IndexOf function and viewing the result:
https://github.com/drin/cookbooks/blob/mainline/arrow/compute-api/index.cpp#L18
I wrote IndexOf to show how you can use the Index function yourself, so you can use it directly, or write a wrapper function in a similar style.
NOTE: I thought I needed to upgrade to 8.0.0 to use Scalar types, but I think 8.0.0 mostly introduced the documentation for Scalar rather than introducing code for it, as this works with arrow 7.0.0.