pitrou commented on a change in pull request #11092:
URL: https://github.com/apache/arrow/pull/11092#discussion_r702844440



##########
File path: r/src/compute.cpp
##########
@@ -398,6 +398,21 @@ std::shared_ptr<arrow::compute::FunctionOptions> 
make_compute_options(
     return out;
   }
 
+  if (func_name == "mode") {
+    using Options = arrow::compute::ModeOptions;
+    auto out = std::make_shared<Options>(Options::Defaults());
+    if (!Rf_isNull(options["n"])) {
+      out->n = cpp11::as_cpp<int>(options["n"]);

Review comment:
       `ModeOptions::n` is an `int64_t`, so perhaps use 
`cpp11::as_cpp<int64_t>`?

##########
File path: r/src/compute.cpp
##########
@@ -398,6 +398,21 @@ std::shared_ptr<arrow::compute::FunctionOptions> 
make_compute_options(
     return out;
   }
 
+  if (func_name == "mode") {
+    using Options = arrow::compute::ModeOptions;
+    auto out = std::make_shared<Options>(Options::Defaults());
+    if (!Rf_isNull(options["n"])) {
+      out->n = cpp11::as_cpp<int>(options["n"]);
+    }
+    if (!Rf_isNull(options["min_count"])) {
+      out->min_count = cpp11::as_cpp<int>(options["min_count"]);

Review comment:
       For the same reason, perhaps `cpp11::as_cpp<uint32_t>`.




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to