You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/09 13:15:15 UTC

[GitHub] [arrow] jonkeane commented on a diff in pull request #13055: ARROW-16253: [R] Helper function for casting from float to duration via int64()

jonkeane commented on code in PR #13055:
URL: https://github.com/apache/arrow/pull/13055#discussion_r867999501


##########
r/R/dplyr-funcs-datetime.R:
##########
@@ -412,8 +412,9 @@ register_bindings_duration <- function() {
 
     if (call_binding("is.character", x)) {
       x <- build_expr("strptime", x, options = list(format = format, unit = 0L))
-      # complex casting only due to cast type restrictions: time64 -> int64 -> duration(us)
+      # complex casting due to cast type restrictions: time64 -> int64 -> duration(us)
       # and then we cast to duration ("s") at the end
+      # we also need the casting chain to get the measurement units right
       x <- x$cast(time64("us"))$cast(int64())$cast(duration("us"))

Review Comment:
   could this be the following?
   
   ```suggestion
         x <- make_duration(x$cast(time64("us"), unit = "us")
   ```



-- 
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-unsubscribe@arrow.apache.org

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