jonkeane commented on a change in pull request #12433:
URL: https://github.com/apache/arrow/pull/12433#discussion_r810508832



##########
File path: r/tests/testthat/test-dplyr-funcs-datetime.R
##########
@@ -711,3 +711,23 @@ test_that("am/pm mirror lubridate", {
   )
 
 })
+
+test_that("date works in arrow", {
+  # https://issues.apache.org/jira/browse/ARROW-13168
+  skip_on_os("windows")
+  # this date is specific since lubridate::date() is different from 
base::as.Date()
+  # since as.Date returns the UTC date and date() doesn't
+  test_df <- tibble(
+    a = as.POSIXct(c("2012-03-26 23:12:13", NA), tz = "America/New_York"))
+
+  # we can't (for now) use namespacing, so we need to make sure 
lubridate::date()
+  # and not base::date() is being used
+  # TODO remove once https://issues.apache.org/jira/browse/ARROW-14575 is done
+  date <- lubridate::date

Review comment:
       This is only necessary in our testing — right? Something about the way 
that `compare_dplyr_binding()` or testthat works makes it so we're not getting 
`lubridate::date()` by default here even though presumably we should since we  
call `library(lubridate, warn.conflicts = FALSE)` at the top of this file, yeah?

##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -147,5 +147,7 @@ register_bindings_datetime <- function() {
   register_binding("pm", function(x) {
     !call_binding("am", x)
   })
-
+  register_binding("date", function(x) {
+    x$cast(date32())
+  })

Review comment:
       Similar to 
https://github.com/apache/arrow/pull/12431#discussion_r810508212 are the errors 
that we get if `x` here is something that would be workable for our users?
   
   Separately, what happens if you pass an R object to this instead of a column 
in an arrow table? Does that work ok?




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