nealrichardson commented on a change in pull request #11176:
URL: https://github.com/apache/arrow/pull/11176#discussion_r712493931
##########
File path: r/src/compute.cpp
##########
@@ -449,6 +449,34 @@ std::shared_ptr<arrow::compute::FunctionOptions>
make_compute_options(
return std::make_shared<Options>(cpp11::as_cpp<int64_t>(options["pivot"]));
}
+ if (func_name == "round") {
+ using Options = arrow::compute::RoundOptions;
+ auto out = std::make_shared<Options>(Options::Defaults());
+ if (!Rf_isNull(options["ndigits"])) {
+ out->ndigits = cpp11::as_cpp<int64_t>(options["ndigits"]);
+ }
+ SEXP round_mode = options["round_mode"];
+ if (!Rf_isNull(round_mode) && TYPEOF(round_mode) == INTSXP &&
+ XLENGTH(round_mode) == 1) {
Review comment:
I _think_ you can get away without this validation here (and below)
because `cpp11::as_cpp` should correctly reject bad input (and this validation
check just silently ignores garbage anyway).
```suggestion
if (!Rf_isNull(round_mode)) {
```
--
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]