dragosmg commented on a change in pull request #12506:
URL: https://github.com/apache/arrow/pull/12506#discussion_r828219382



##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -189,6 +189,65 @@ register_bindings_datetime <- function() {
   })
 }
 
+register_bindings_duration <- function() {
+  register_binding("difftime", function(time1,
+                                        time2,
+                                        tz,
+                                        units = c("auto", "secs", "mins",
+                                                  "hours", "days", "weeks")) {
+    units <- match.arg(units)
+    if (units != "secs") {
+      abort("`difftime()` with units other than seconds not supported in 
Arrow")
+    }
+
+    if (!missing(tz)) {
+      warn("`tz` is an optional argument to `difftime()` in R and will not be 
used in Arrow")
+    }
+
+    time1 <- build_expr("cast", time1, options = cast_options(to_type = 
timestamp()))
+    time2 <- build_expr("cast", time2, options = cast_options(to_type = 
timestamp()))

Review comment:
       ~See above, but by casting to the `tz` passed as arg we were masking the 
issue of `Scalar$create()` dropping the `tz` metadata. Casting to a different / 
wrong `tz` had no material impact on the result, but now it does since Arrow 
does not like subtracting a timezoned timestamp from a timezoneless one.~




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to