rok commented on pull request #11105:
URL: https://github.com/apache/arrow/pull/11105#issuecomment-921185627


   Another thing to note here is that behavior of the `%S` flag is different in 
arrow:
   
   > Output precision of %S (seconds) flag depends on the input timestamp 
precision. Timestamps with second precision are represented as integers while 
milliseconds, microsecond and nanoseconds are represented as fixed floating 
point numbers with 3, 6 and 9 decimal places respectively. To obtain integer 
seconds, cast to timestamp with second resolution. The character for the 
decimal point is localized according to the locale. See detailed formatting 
documentation for descriptions of other flags.
   
   This is already tested in c++ and we test it in Python [like 
so](https://github.com/apache/arrow/blob/376cb450392fcfc2c4e3c5487358f4906c3383da/python/pyarrow/tests/test_compute.py#L1589).
 I'm not sure there's a point in testing it in R but it could look like this:
   ```R
     arr <- Array$create(c(lubridate::ymd_hms("2018-10-07 19:04:05"), NA), type 
= timestamp("s"))
     expect_dplyr_equal(
       input %>%
         mutate(x = strftime(x, format = "%S")) %>%
         collect(),
       arr
     )
   ```
   Except this wouldn't work for type reasons:
   ```R
   Error (test-dplyr-string-functions.R:756:3): strftime
   Error: no applicable method for 'mutate' applied to an object of class 
"c('Array', 'ArrowDatum', 'ArrowObject', 'R6')"
   ```


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