thisisnic commented on a change in pull request #11105:
URL: https://github.com/apache/arrow/pull/11105#discussion_r712189682
##########
File path: r/R/dplyr-functions.R
##########
@@ -672,6 +672,18 @@ 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 (usetz) {
+ format <- paste(format, "%Z")
+ }
+ if (tz == "") {
+ tz <- Sys.timezone()
+ }
+ unit <- TimestampType__unit(x$type())
+ ts <- Expression$create("cast", x, options = list(to_type = timestamp(unit,
tz)))
Review comment:
Please could you add a comment above these lines explaining why you're
casting this?
Also, calling `TimestampType__unit()` directly feels a little unidiomatic -
the functions with that syntax tend to only be called from within R6 classes.
@jonkeane - it'd be good to get your thoughts here.
--
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]