-
Notifications
You must be signed in to change notification settings - Fork 848
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
[Bug]: time_bucket_gapfill with named timezone gives incorrect result #6844
Comments
@intermittentnrg Could you please provide the table definitions for the tables involved. It would help to have some sample rows from the hypertable to see if we can repro the problem ( Are any continuous aggregates involved in the query?) Could you also please paste the query here: I tried to add it but not able to copy and paste. |
Full query from query inspector:
generation is actually a view that selects
I need to make a dbfiddle I guess.. |
The issue seems to start from 2023-03-31 when daylight savings happened |
Created dbfiddle that reproduces: https://dbfiddle.uk/ltQgomQN |
Here is a much shorter dbfiddle https://dbfiddle.uk/b8DUocAn SELECT time_bucket_gapfill('7d', time, 'Europe/Stockholm') AS time,
AVG(extract(epoch from time))
FROM generate_series('2024-03-14'::timestamptz, '2024-04-14'::timestamptz, '1d') AS time
WHERE time BETWEEN '2024-03-14' AND '2024-04-14'
GROUP BY 1 |
Another example that had me confused, cause it doesn't ORDER BY time even when I told it to: https://dbfiddle.uk/ySRKeqsp Looks like it's gapfiling the previous DST timezone? |
Ah sorry I didn't Seems this was bug #6507 time_bucket_gapfill with timezones doesn't handle daylight savings There is #6510 backport to 2.13 merged but per changelog it's not been released. |
This issue is resolved and ready to be closed. Would be good if there was a new 2.13 release that includes the backported fix tho. |
I'm sorry, I don't think we offer that kind long term support for individual minor releases. Your best bet is to upgrade to 2.14.2. TimescaleDB is under heavy development and we are actually in the process of releasing version 2.15. I'll close this issue, feel free to reopen it if you have any other questions. Thanks again! |
What type of bug is this?
Incorrect result
What subsystems and features are affected?
Gapfill
What happened?
I host Grafana at https://intermittent.energy which has electricity grid data from around the world for many timezones like Europe/America/Australia.
Grafana 10.1.0 just added the variable
$__timezone
which has value likeEurope/Stockholm
which is correct value for time_bucket_gapfill timezone parameter https://docs.timescale.com/api/latest/hyperfunctions/gapfilling/time_bucket_gapfill#time_bucket_gapfill.However it gives incorrect result:
Without timezone parameter I get expected result:
The only difference in these screenshots is the
'Europe/Stockholm'
parameter to time_bucket_gapfill.Direct link to edit query in Grafana screenshots above, which allows edit and run query as anonymous visitor: https://intermittent.energy/d/QCEg6rl7z/generation?orgId=1&var-region=europe&var-area_type=country&var-area=10&var-production_type=5&var-group_by=production_type&var-demand=0&var-min_interval=1h&var-gapfill_function=interpolate&from=now-1y%2Fy&to=now-1y%2Fy&editPanel=4
TimescaleDB version affected
2.12.2, 2.13.1, 2.14.2
PostgreSQL version used
14 (using timescaledb/timescaledb -pg14 docker image
What operating system did you use?
Docker on k3s, Ubuntu 22.04.3 LTS with containerd 1.7.2-0ubuntu1~22.04.1
What installation method did you use?
Docker
What platform did you run on?
On prem/Self-hosted
Relevant log output and stack trace
Inspect data with time_bucket_gapfill(..., timezone) in Grafana shows these rows returned (click Query Insector > Data from above link, after editing timezone parameter):
How can we reproduce the bug?
I suppose you want a reproducible dbfiddle aswell, but thought I'd report this early as it seems as a clear bug, and can be reproduced via links to my grafana per above.
The text was updated successfully, but these errors were encountered: