-
Notifications
You must be signed in to change notification settings - Fork 190
Fix POSIXt precision and tzone #665
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
base: main
Are you sure you want to change the base?
Conversation
R/bq-perform.R
Outdated
| # Convert times to canonical format | ||
| is_time <- vapply(values, function(x) inherits(x, "POSIXt"), logical(1)) | ||
| values[is_time] <- lapply(values[is_time], format, "%Y-%m-%d %H:%M:%S") | ||
| digsec <- getOption("bigrquery.digits.secs") |
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.
Do you think we need to make this an option? i.e. why not always use 6 digits?
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.
Fair question. Two reasons, for better or worse:
- Backward compatibility, so that revdeps don't see starkly-changing behavior.
- Consistency with
jsonlite's notion of "smaller is better" (regardless of lossy-ness).
Some (perhaps even most) people may not care about millisecond-resolution, I don't assume everybody is as concerned about it as I am. If it's hard-coded 6 then I'll be fine.
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.
I think I'd prefer making it a constant. I don't think it should negatively affect revdeps; it might change some results in very small ways, but those changes should generally be for the better.
hadley
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.
Big picture now looks good, so it's time for the nit-picking 😄 Thanks for working on this!
Two steps here for
POSIXtvalue preservation:"tzone"attribute when missing/emptyoptions(bigrquery.digits.secs=6)to allow sending up to 6 sub-second digits toPOSIXt-class objectsBefore this patch,
Just fixing "tzone", we can get
To support microsecond precision,
Includes NEWS, code, and unit-tests.