eitsupi commented on code in PR #12707:
URL: https://github.com/apache/arrow/pull/12707#discussion_r946390561


##########
r/R/dplyr-funcs-datetime.R:
##########
@@ -270,6 +270,20 @@ register_bindings_duration <- function() {
       time2 <- build_expr("cast", time2, options = cast_options(to_type = 
timestamp(timezone = "UTC")))
     }
 
+    # if time1 or time2 are timestamps they cannot be expressed in "s" /seconds
+    # otherwise they cannot be added subtracted with durations
+    # TODO delete the casting to "us" once
+    # https://issues.apache.org/jira/browse/ARROW-16060 is solved
+    if (inherits(time1, "Expression") &&
+        time1$type_id() %in% Type[c("TIMESTAMP")] && time1$type()$unit() != 
2L) {
+      time1 <- build_expr("cast", time1, options = cast_options(to_type = 
timestamp("us")))
+    }
+
+    if (inherits(time2, "Expression") &&
+        time2$type_id() %in% Type[c("TIMESTAMP")] && time2$type()$unit() != 
2L) {
+      time2 <- build_expr("cast", time2, options = cast_options(to_type = 
timestamp("us")))
+    }

Review Comment:
   Can we update this section since it looks like ARROW-16060 has already been 
solved?



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