-
Notifications
You must be signed in to change notification settings - Fork 278
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
Add new date_bin_wallclock SQL functions #5691
base: master
Are you sure you want to change the base?
Conversation
content/influxdb/cloud-dedicated/reference/sql/functions/time-and-date.md
Outdated
Show resolved
Hide resolved
content/influxdb/cloud-dedicated/reference/sql/functions/time-and-date.md
Outdated
Show resolved
Hide resolved
content/influxdb/cloud-dedicated/reference/sql/functions/time-and-date.md
Outdated
Show resolved
Hide resolved
content/influxdb/cloud-dedicated/reference/sql/functions/time-and-date.md
Outdated
Show resolved
Hide resolved
content/influxdb/cloud-dedicated/reference/sql/functions/time-and-date.md
Show resolved
Hide resolved
content/influxdb/clustered/reference/sql/functions/time-and-date.md
Outdated
Show resolved
Hide resolved
content/influxdb/clustered/reference/sql/functions/time-and-date.md
Outdated
Show resolved
Hide resolved
content/influxdb/clustered/reference/sql/functions/time-and-date.md
Outdated
Show resolved
Hide resolved
|
||
Use `date_bin_wallclock_gapfill` with [`interpolate`](/influxdb/clustered/reference/sql/functions/misc/#interpolate) | ||
or [`locf`](/influxdb/clustered/reference/sql/functions/misc/#locf) to | ||
[fill gaps in data]() |
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.
Missing URL
content/influxdb/clustered/reference/sql/functions/time-and-date.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Jason Stirnaman <[email protected]>
|
||
### Time zone shifts | ||
|
||
Many regions use time zone shifts (such as Daylight Saving Time (DST) and British |
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.
"Daylight Saving Time" and "British Summer Time" aren't equivalents. DST refers to the general concept of adjusting the local time to make the most of the daylight hours. BST is a time zone offset identifier. I think this should be reworded a little to express that.
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.
@mhilton Thanks. Is there a generalized term you use in the UK to represent the 1 hour seasonal offset? Is it just Daylight Savings Time? In the US, we have the general "DST," but we also have timezone-specific offset identifiers (Pacific Standard Time (PST) vs Pacific Daylight Time (PDT)).
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.
Yes it's very similar, but in the UK we only have to worry about one time-zone so they can be used haphazardly. The concept is known as "Daylight Saving Time" which changes the timezone from "GMT" to "BST".
UTC offset of the input timestamp. | ||
|
||
```sql | ||
date_bin_wallclock(interval, expression[, origin]) |
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.
date_bin_wallclock(interval, expression[, origin]) | |
date_bin_wallclock(interval, expression[, origin_timestamp]) |
The arguments defined below uses origin_timestamp
. To keep wording consistent, maybe changing the word to origin_timestamp
here, or changing the word to origin
below?
The output timestamp uses the time zone from this time expression. | ||
- **origin_timestamp**: Starting point used to determine bin boundaries. | ||
This must be a "wall clock" timestamp (no time zone). | ||
_Default is the Unix epoch._ |
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.
It would be good to highlight a caveat:
Using an origin
and interval
such that there are bins within a discontinuity, but which do not align with the point at which the discontinuity occurs, can produce unexpected results. For example, considering the following query:
SELECT date_bin_wallclock(INTERVAL '1 hour', tz('2020-10-25T02:29:00+01:00', 'Europe/Paris'), '1970-01-01T00:30:00') AT TIME ZONE 'UTC';
The result is:
2020-10-24T23:30:00Z
However, the result of a nearly identical query:
SELECT date_bin_wallclock(INTERVAL '1 hour', tz('2020-10-25T02:30:00+01:00', 'Europe/Paris'), '1970-01-01T00:30:00') AT TIME ZONE 'UTC';
is:
2020-10-25T01:30:00Z
That is, timestamps only one minute apart are placed into bins that are two hours apart, despite the expected interval being one hour. Care should be taken to avoid such scenarios.
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.
In general advice to try and stay away from the discontinuities is probably sensible.
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.
👍 , pending other reviewer suggestions.
Related to https://github.com/influxdata/influxdb_iox/issues/12681
Adds the following SQL functions to the Serverless, Dedicated, and Clustered docs:
date_bin_wallclock
date_bin_wallclock_gapfill