thisisnic commented on code in PR #13440:
URL: https://github.com/apache/arrow/pull/13440#discussion_r909328054


##########
r/R/dplyr-funcs-datetime.R:
##########
@@ -172,6 +172,15 @@ register_bindings_datetime_components <- function() {
     (call_binding("yday", x) - 1) %/% 7 + 1
   })
 
+  register_binding("qday", function(x) {
+    x <- build_expr("floor_temporal", x, options = list(unit = 6L, 
calendar_based_origin = FALSE))
+    x <- build_expr("cast", x, options = cast_options(to_type = 
timestamp("s")))
+    floored_x <- build_expr("floor_temporal", x, options = list(unit = 9L, 
calendar_based_origin = FALSE))
+    duration_between <- build_expr("subtract", x, floored_x)
+    seconds_between <- build_expr("cast", duration_between, options = 
cast_options(to_type = int64()))
+    build_expr("floor", seconds_between / Expression$scalar(86400L) + 
Expression$scalar(1L))

Review Comment:
   Please can you add some comments here explaining why we need these steps?



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