-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-14199 [R] bindings for format (where possible) #12319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
|
TL/DR: ================= I think the failures I am seeing so far are due to the difference between library(dplyr, warn.conflicts = FALSE)
library(lubridate, warn.conflicts = FALSE)
times <- tibble(
datetime = c(lubridate::ymd_hms("2018-10-07 19:04:05", tz = "Etc/GMT+6"), NA),
date = c(as.Date("2021-01-01"), NA)
)
formats <- "%a %A %w %d %b %B %m %y %Y %H %I %p %M %z %Z %j %U %W %x %X %% %G %V %u"
a <- times$datetime[1]
a
#> [1] "2018-10-07 19:04:05 -06"
format(a, format = formats)
#> [1] "Sun Sunday 0 07 Oct October 10 18 2018 19 07 PM 04 -0600 -06 280 40 40 10/07/2018 19:04:05 % 2018 40 7"
strftime(a, format = formats)
#> [1] "Mon Monday 1 08 Oct October 10 18 2018 02 02 AM 04 +0100 BST 281 40 41 10/08/2018 02:04:05 % 2018 41 1"Created on 2022-02-02 by the reprex package (v2.0.1) The difference boils down to: # format()
format(as.POSIXlt(a), format = formats)
#> [1] "Sun Sunday 0 07 Oct October 10 18 2018 19 07 PM 04 -0600 -06 280 40 40 10/07/2018 19:04:05 % 2018 40 7"
# strftime()
format(as.POSIXlt(a, tz = ""), format = formats)
#> [1] "Mon Monday 1 08 Oct October 10 18 2018 02 02 AM 04 +0100 BST 281 40 41 10/08/2018 02:04:05 % 2018 41 1"Created on 2022-02-02 by the reprex package (v2.0.1) |
jonkeane
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! a few comments / suggestions at a high level
paleolimbot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The datetime bits are looking good! I added a few comments that may help to handle other types of objects that might get passed to format().
|
Follow-up ticket to remove / revisit the manual casting step - ARROW-15762. |
|
@jonkeane I think this is ready for another pass if/when you have a bit of time |
38ef681 to
705e1eb
Compare
705e1eb to
c0688e1
Compare
jonkeane
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good — one super minor test addition and a question about build_expr() + clauses catching non-expressions
jonkeane
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there! One comment about a comment + a question about the tests
…t()` for regular R objects
jonkeane
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks for sticking through this.
|
Benchmark runs are scheduled for baseline = 33fd1c2 and contender = dc2e0b2. dc2e0b2 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
No description provided.