dragosmg commented on code in PR #13190:
URL: https://github.com/apache/arrow/pull/13190#discussion_r889987812
##########
r/R/dplyr-funcs-datetime.R:
##########
@@ -28,25 +28,52 @@ register_bindings_datetime <- function() {
}
register_bindings_datetime_utility <- function() {
- register_binding("strptime", function(x, format = "%Y-%m-%d %H:%M:%S", tz =
NULL,
+ register_binding("strptime", function(x,
+ format = "%Y-%m-%d %H:%M:%S",
+ tz = "",
unit = "ms") {
# Arrow uses unit for time parsing, strptime() does not.
# Arrow has no default option for strptime (format, unit),
# we suggest following format = "%Y-%m-%d %H:%M:%S", unit = MILLI/1L/"ms",
# (ARROW-12809)
- # ParseTimestampStrptime currently ignores the timezone information
(ARROW-12820).
- # Stop if tz is provided.
- if (is.character(tz)) {
- arrow_not_supported("Time zone argument")
- }
+ unit <- make_valid_time_unit(
+ unit,
+ c(valid_time64_units, valid_time32_units)
+ )
+
+ output <- build_expr(
+ "strptime",
+ x,
+ options =
+ list(
+ format = format,
+ unit = unit,
+ error_is_null = TRUE
+ )
+ )
- unit <- make_valid_time_unit(unit, c(valid_time64_units,
valid_time32_units))
+ if (tz == "") {
+ tz <- Sys.timezone()
+ }
- build_expr("strptime", x, options = list(format = format, unit = unit,
error_is_null = TRUE))
+ if (!is.null(tz)) {
+ output <- build_expr(
+ "assume_timezone",
+ output,
+ options =
+ list(
+ timezone = tz
+ )
+ )
+ }
+ output
Review Comment:
Done
--
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]