thisisnic commented on a change in pull request #11357:
URL: https://github.com/apache/arrow/pull/11357#discussion_r724516367
##########
File path: r/src/compute.cpp
##########
@@ -254,6 +254,11 @@ std::shared_ptr<arrow::compute::FunctionOptions>
make_compute_options(
cpp11::as_cpp<bool>(options["skip_nulls"]));
}
+ if (func_name == "index") {
+ using Options = arrow::compute::IndexOptions;
+ return
std::make_shared<Options>(cpp11::as_cpp<arrow::Scalar>(options["value"]));
Review comment:
> Perhaps try cpp11::as_cpp<std::shared_ptr<arrow::Scalar>>
Whilst this way actually compiles, it means I have to supply an Arrow Object
to the call, e.g.
`call_function("index", Array$create(c(1, 2, 3, 4, 5)), options = list(value
= Scalar$create(2)))`
which is inconsistent with all the other Arrow functions.
If I try the same suggestion, with `<arrow::Datum>` in the place of
`<arrow::Scalar>` it fails to compile with this error: `error: matching
function for call to
‘arrow::compute::IndexOptions::IndexOptions(std::shared_ptr<arrow::Datum>)`
Similarly, if I try it without the `<std::shard_ptr...>` bit, I just get
`error: matching function for call to
‘arrow::compute::IndexOptions::IndexOptions(arrow::Datum)`.
I will try to see if I can find other code from converting from R objects to
Arrow that I can copy to wrap around `options["value"]` maybe?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]