thisisnic commented on a change in pull request #11105:
URL: https://github.com/apache/arrow/pull/11105#discussion_r710985582



##########
File path: r/R/dplyr-functions.R
##########
@@ -672,6 +672,16 @@ nse_funcs$strptime <- function(x, format = "%Y-%m-%d 
%H:%M:%S", tz = NULL, unit
   Expression$create("strptime", x, options = list(format = format, unit = 
unit))
 }
 
+nse_funcs$strftime <- function(x, format = "", tz = "", usetz = FALSE) {
+  if (tz != "") {
+    arrow_not_supported("tz argument")

Review comment:
       Is it possible? Maybe.  Here's the steps I'd take to find out:
   
   1. Open R, load Arrow, and call `list_compute_functions()` to get a list of 
compute kernels available from R.  I see "cast" is there, so this looks 
promising.  Alternatively, I could start by looking at the C++ compute kernels 
documentation to see if there are any fitting kernels.
   
   2. Open `arrow/r/src/compute.cpp` to check if the `cast` kernel has its 
options bound and if so, what are they.  It does, and the key one here is 
`to_type`.
   
   3. Play around with `call_function()` (R function you can use for directly 
calling compute kernels to test things etc).  I ended up with this example 
working for me: `call_function("cast", Array$create(c(1:3L)), options = 
list(to_type = utf8()))`.  Not the simil
   
   4. I'm pretty sure we can have Expressions which take other Expressions as 
arguments, I've implemented things with this in the past, though there are no 
current code examples, so I'd experiment with that.  Here's an example using 
`call_function()` which could be analogous to how it works with Expressions:
   
   ```
   call_function(
     "replace_substring",
     call_function(
       "cast",
       Array$create(c(1:3L)),
       options = list(to_type = utf8())
     ),
     options = list(pattern = "1", replacement = "one")
   )
   ```
   
   Should we do it?  I *think* so, though I'm a bit hesitant to say "yes" as 
I'm concerned about unintended consequences or inconsistencies.  But then 
again, I guess that's what unit tests are for, right? ;) 




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