AlenkaF commented on code in PR #12855:
URL: https://github.com/apache/arrow/pull/12855#discussion_r855492715


##########
r/tests/testthat/test-dplyr-funcs-datetime.R:
##########
@@ -1303,6 +1303,74 @@ test_that("dminutes, dhours, ddays, dweeks, dmonths, 
dyears", {
     tibble(),
     ignore_attr = TRUE
   )
+
+  # double -> duration not supported in Arrow.
+  # Error is generated in the C++ code
+  expect_error(
+    test_df %>%
+      arrow_table() %>%
+      mutate(r_obj_dminutes = dminutes(1.12345)) %>%
+      collect()
+  )
+})
+
+test_that("dseconds, dmilliseconds, dmicroseconds, dnanoseconds, 
dpicoseconds", {
+  example_d <- tibble(x = c(1:10, NA))
+  date_to_add <- ymd("2009-08-03", tz = "Pacific/Marquesas")
+
+  compare_dplyr_binding(
+    .input %>%
+      mutate(
+        dseconds = dseconds(x),
+        dmilliseconds = dmilliseconds(x),
+        dmicroseconds = dmicroseconds(x),
+        dnanoseconds = dnanoseconds(x),
+      ) %>%
+      collect(),
+    example_d,
+    ignore_attr = TRUE
+  )
+
+  compare_dplyr_binding(
+    .input %>%
+      mutate(
+        dseconds = dseconds(x),
+        dmicroseconds = dmicroseconds(x),
+        new_date_1 = date_to_add + dseconds,
+        new_date_2 = date_to_add + dseconds - dmicroseconds,
+        new_duration = dseconds - dmicroseconds
+      ) %>%
+      collect(),
+    example_d,
+    ignore_attr = TRUE

Review Comment:
   I will add a comment, you can wait with merging. But I have to remember, if 
I am honest =) Will do it tomorrow morning and add the comment then.
   
   Thank you for the review!



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