dragosmg commented on code in PR #13160:
URL: https://github.com/apache/arrow/pull/13160#discussion_r921536397
##########
r/R/dplyr-funcs.R:
##########
@@ -58,15 +58,34 @@ NULL
#' @keywords internal
#'
register_binding <- function(fun_name, fun, registry = nse_funcs) {
- name <- gsub("^.*?::", "", fun_name)
- namespace <- gsub("::.*$", "", fun_name)
+ qualified_name <- fun_name
+ if (qualified_name == "::") {
+ unqualified_name <- "::"
+ } else {
+ unqualified_name <- gsub("^.*?::", "", qualified_name)
+ }
- previous_fun <- if (name %in% names(registry)) registry[[name]] else NULL
+ previous_fun <- if (unqualified_name %in% names(registry))
registry[[unqualified_name]] else NULL
+
+ # if th unqualified name exists in the register, warn
+ if (!is.null(fun) && !is.null(previous_fun)) {
+ warn(
+ paste0(
+ "A \"",
+ unqualified_name,
+ "\" binding already exists in the register and will be overwritten.")
+ )
+ }
+ # if fun is NULL remove entries from the function registry
Review Comment:
Not 💯 convinced it is a real use case. We test it
[here](https://github.com/dragosmg/arrow/blob/eb5d35a735bb97e706e6c4a0f0e7f6f06bc3cb7f/r/tests/testthat/test-dplyr-funcs.R#L27-L28).
--
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]