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 2021/09/10 15:10:08 UTC

[GitHub] [arrow] thisisnic commented on a change in pull request #11119: ARROW-13959: [R] Update tests for extracting components from date32 objects

thisisnic commented on a change in pull request #11119:
URL: https://github.com/apache/arrow/pull/11119#discussion_r706261111



##########
File path: r/tests/testthat/test-dplyr-lubridate.R
##########
@@ -32,97 +32,132 @@ if (tolower(Sys.info()[["sysname"]]) == "windows") {
 } else {
   test_date <- as.POSIXct("2017-01-01 00:00:12.3456789", tz = "Pacific/Marquesas")
 }
-test_df <- tibble::tibble(date = test_date)
-test_date_df <- tibble::tibble(date = as.Date(as.character(test_date)))
 
-test_that("extract year from date32 objects", {
-  expect_equivalent(
-    test_date_df %>%
-      mutate(x = year(date)) %>%
-      collect() %>%
-      select(x),
-    test_df %>%
-      mutate(x = year(date)) %>%
-      collect() %>%
-      select(x)
+test_df <- tibble::tibble(
+  datetime = test_date,
+  date = as.Date("2021-09-09")
+)
+
+test_that("extract year from timestamp", {
+  expect_dplyr_equal(
+    input %>%
+      mutate(x = year(datetime)) %>%

Review comment:
       So the earlier tests in the file are testing datetimes aka timestamps whereas the later ones are testing dates/date32 objects.  I've added in a couple of comments to make this more clear.




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