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



##########
File path: r/src/compute.cpp
##########
@@ -208,7 +208,7 @@ std::shared_ptr<arrow::compute::FunctionOptions> 
make_compute_options(
     return out;
   }
 
-  if (func_name == "hash_count_distinct") {
+  if (func_name == "count_distinct" || func_name == "hash_count_distinct") {

Review comment:
       The rough idea:
   ```c++
   
   std::shared_ptr<arrow::compute::FunctionOptions> make_compute_options(
       const std::string& options_name, cpp11::list options) {
     if (options_name == "ScalarAggregateOptions") {
       using Options = arrow::compute::ScalarAggregateOptions;
       auto out = std::make_shared<Options>(Options::Defaults());
       if (!Rf_isNull(options["min_count"])) {
         out->min_count = cpp11::as_cpp<int>(options["min_count"]);
       }
       if (!Rf_isNull(options["skip_nulls"])) {
         out->skip_nulls = cpp11::as_cpp<bool>(options["skip_nulls"]);
       }
       return out;
     }
     if (options_name == "TDigestOptions") {
       // etc;
     }
     return nullptr;
   }
   
   // [[arrow::export]]
   SEXP compute__CallFunction(const std::string& func_name, cpp11::list args, 
cpp11::list options) {
     auto func = ValueOrStop(
         arrow::compute::GetFunctionRegistry()->GetFunction(func_name));
     auto opts = make_compute_options(func.doc()->options_class, options);
     auto datum_args = arrow::r::from_r_list<arrow::Datum>(args);
     auto out = ValueOrStop(func->Execute(datum_args, opts.get(), 
gc_context()));
     return from_datum(std::move(out));
   }
   ```
   




-- 
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]


Reply via email to