-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Support timezone offsets for queries #7762
Conversation
This still requires tests. I've only verified a single query with this and haven't tried the edge cases or tested the efficiency. I also think the changes to the fill iterator are going to need to be different so it's faster, but that's only a hunch at the moment. For those following this issue and seeing this PR, it will not end up in 1.2 and is potentially targeted at 1.3 at the moment. I just wanted to get it up now because I finally thought of a way to do this and wanted to write the code down before I forgot. |
a3991df
to
a5a5bfa
Compare
This now has tests and fixed some bugs when traveling between time offsets. This is likely fine to be reviewed and tested more thoroughly now. |
d2078aa
to
f18d491
Compare
d907d70
to
04d1cc3
Compare
👍 This would be useful for pulling CSV data that no longer needs to be modified by the pulling application. |
04d1cc3
to
67f214e
Compare
4f3d241
to
bdd003f
Compare
@jsternberg I think the syntax should be single quotes.
Thoughts? |
I can do that. I wasn't sure which one to use anyway since we muddle the water between identifiers and strings in a few too many places. |
2085425
to
b9c9f01
Compare
The timezone for a query can now be added to the end with something like `TZ("America/Los_Angeles")` and it will localize the results of the query to be in that timezone. The offset will automatically be set to the offset for that timezone and offsets will automatically adjust for daylight savings time so grouping by a day will result in a 25 hour day once a year and a 23 hour day another day of the year. The automatic adjustment of intervals for timezone offsets changing will only happen if the group by period is greater than the timezone offset would be. That means grouping by an hour or less will not be affected by daylight savings time, but a 2 hour or 1 day interval will be. The default timezone is UTC and existing queries are unaffected by this change. When times are returned as strings (when `epoch=1` is not used), the results will be returned using the requested timezone format in RFC3339 format.
b9c9f01
to
347b018
Compare
Updated to 1.2.3 using deb package on ubuntu. While trying queries with TZ('America/Los_Angeles') at the end, I m getting the following error: |
Time zones are slated for 1.3. They should be in master right now. |
Okay. So, I build influxdb from the git master branch on a docker image. TZ function is now recognizable but cant find the timezone. Using tz('America/Los_Angeles') throws an error "unable to find time zone America/Los_Angeles". Error goes with other timezones as well. |
Please direct usage questions to our community website at https://community.influxdata.com. |
Updated the PR comment to use single quotes instead of double quotes. That got changed during review but never got changed in the PR comment. |
The timezone for a query can now be added to the end with something like
TZ('America/Los_Angeles')
and it will localize the results of thequery to be in that timezone. The offset will automatically be set to
the offset for that timezone and offsets will automatically adjust for
daylight savings time so grouping by a day will result in a 25 hour day
once a year and a 23 hour day another day of the year.
The automatic adjustment of intervals for timezone offsets changing will
only happen if the group by period is greater than the timezone offset
would be. That means grouping by an hour or less will not be affected by
daylight savings time, but a 2 hour or 1 day interval will be.
The default timezone is UTC and existing queries are unaffected by this
change.
When times are returned as strings (when
epoch=1
is not used), theresults will be returned using the requested timezone format in RFC3339
format.
Fixes #6541.