ianmcook commented on a change in pull request #9916:
URL: https://github.com/apache/arrow/pull/9916#discussion_r609295183
##########
File path: r/R/compute.R
##########
@@ -34,6 +48,30 @@ call_function <- function(function_name, ..., args =
list(...), options = empty_
compute__CallFunction(function_name, args, options)
}
+#' List available Arrow C++ compute functions
+#'
+#' This function lists the names of all available Arrow compute functions.
+#' These can be called by passing to [call_function()], or they can be
+#' called by name with an `arrow_` prefix inside a `dplyr` verb.
+#'
+#' The resulting list describes the capabilities of your `arrow` build.
+#' Some functions, such as string and regular expression functions,
+#' require optional build-time C++ dependencies. If your `arrow` package
+#' was not compiled with those features enabled, those functions will
+#' not appear in this list.
+#'
+#' @param pattern Optional regular expression to filter the function list
+#' @param ... Additional parameters passed to `grep()`
+#' @return A character vector of available Arrow C++ function names
+#' @export
+list_compute_functions <- function(pattern = NULL, ...) {
+ funcs <- compute__GetFunctionNames()
+ if (!is.null(pattern)) {
+ funcs <- grep(pattern, funcs, value = TRUE, ...)
+ }
+ funcs
+}
Review comment:
Oh, disregard—I see this is coming straight from the C++ and not through
our R mappings.
##########
File path: r/R/compute.R
##########
@@ -34,6 +48,30 @@ call_function <- function(function_name, ..., args =
list(...), options = empty_
compute__CallFunction(function_name, args, options)
}
+#' List available Arrow C++ compute functions
+#'
+#' This function lists the names of all available Arrow compute functions.
+#' These can be called by passing to [call_function()], or they can be
+#' called by name with an `arrow_` prefix inside a `dplyr` verb.
+#'
+#' The resulting list describes the capabilities of your `arrow` build.
+#' Some functions, such as string and regular expression functions,
+#' require optional build-time C++ dependencies. If your `arrow` package
+#' was not compiled with those features enabled, those functions will
+#' not appear in this list.
+#'
+#' @param pattern Optional regular expression to filter the function list
+#' @param ... Additional parameters passed to `grep()`
+#' @return A character vector of available Arrow C++ function names
+#' @export
+list_compute_functions <- function(pattern = NULL, ...) {
+ funcs <- compute__GetFunctionNames()
+ if (!is.null(pattern)) {
+ funcs <- grep(pattern, funcs, value = TRUE, ...)
+ }
+ funcs
+}
Review comment:
Would it be possible to name the output vector with the names of the R
functions mapped to these compute functions (where such mappings exist, and for
the others leave them nameless)?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]