paleolimbot commented on code in PR #14436:
URL: https://github.com/apache/arrow/pull/14436#discussion_r997174084


##########
r/R/compute.R:
##########
@@ -379,9 +379,15 @@ register_scalar_function <- function(name, fun, in_type, 
out_type,
   RegisterScalarUDF(name, scalar_function)
 
   # register with dplyr binding (enables its use in mutate(), filter(), etc.)
+  # extra step to avoid saving this execution environment in the binding,
+  # which eliminates a warning when the same binding is registered twice
+  binding_fun <- function(...) build_expr(name, ...)
+  body(binding_fun)[[2]] <- name

Review Comment:
   I pushed a less cryptic version of this...it's inlining the value of `name` 
into the function body:
   
   ``` r
   binding_fun <- function(...) build_expr(name, ...)
   str(as.list(body(binding_fun)))
   #> List of 3
   #>  $ : symbol build_expr
   #>  $ : symbol name
   #>  $ : symbol ...
   ```



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