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


##########
r/tests/testthat/test-Array.R:
##########
@@ -1397,3 +1397,9 @@ test_that("Can convert R integer/double to decimal 
(ARROW-11631)", {
     "Conversion to decimal from non-integer/double"
   )
 })
+
+test_that("Array handles sub-day precision Date correctly", {
+  d <- as.Date(-0.1)
+  arr <- arrow_array(d)
+  expect_equal(as.vector(arr), as.Date("1969-12-31"))
+})

Review Comment:
   It happens specifically in the case of negative fractional values, e.g. 
turning -0.4 into 0, which shifted the date forward by a day. This happened 
because it truncated toward zero instead of flooring. I'll update the 
description to be more explicit about this.



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