Skip to content
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

fix(query): Group By queries with offset that crosses a DST boundary can fail #20230

Merged
merged 4 commits into from
Dec 4, 2020

Conversation

davidby-influx
Copy link
Contributor

@davidby-influx davidby-influx commented Dec 2, 2020

Customer reported that a GROUP BY query with an offset that caused an interval
to cross a daylight savings change inserted an extra output row off by one hour.

This fix ensured that the start time for the interval of a GROUP BY operator is
correctly set before calculating the time zone offset for that date and time.

Fixes #20238

…can fail

Customer reported that a GROUP BY query with an offset that caused an interval
to cross a daylight savings change inserted an extra output row off by one hour.
This fix ensured that the start time for the interval of a GROUP BY operator is
correctly set before calculating the time zone offset for that date and time.
gshif
gshif previously approved these changes Dec 2, 2020
@@ -815,6 +815,8 @@ func (opt IteratorOptions) Window(t int64) (start, end int64) {
start = t - dt
}

start += int64(opt.Interval.Offset)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some tests for this behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do. @gshif developed a truly minimal repro case I can encapsulate in a test.

…can fail

Customer reported that a GROUP BY query with an offset that caused an interval
to cross a daylight savings change inserted an extra output row off by one hour.
This fix ensured that the start time for the interval of a GROUP BY operator is
correctly set before calculating the time zone offset for that date and time.

Fixes #20238
Add a regression test for #20238
to ensure that GROUP BY queries operate correctly when their Interval.Offset
causes them to cross daylight savings time boundaries.
@davidby-influx
Copy link
Contributor Author

Added a regression test, TestGroupByIterator_DST() in query/iterator_test.go. @jsternberg, take a look at your convenience.

@davidby-influx davidby-influx merged commit df39b1e into master-1.x Dec 4, 2020
@davidby-influx davidby-influx deleted the DSB_influxdb_EAR1855 branch December 4, 2020 17:40
@davidby-influx davidby-influx linked an issue Dec 7, 2020 that may be closed by this pull request
davidby-influx added a commit that referenced this pull request Dec 7, 2020
…can fail (#20230)

* fix(query): Group By queries with offset that crosses a DST boundary can fail

Customer reported that a GROUP BY query with an offset that caused an interval
to cross a daylight savings change inserted an extra output row off by one hour.
This fix ensured that the start time for the interval of a GROUP BY operator is
correctly set before calculating the time zone offset for that date and time.

Add TestGroupByIterator_DST() in query/iterator_test.go
for regression testing of this bug.

Fixes #20238

(cherry picked from commit df39b1e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GROUP BY query with offset crossing DST change fails
3 participants