-
Notifications
You must be signed in to change notification settings - Fork 493
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
groupBy node doesn't have expected behaviour #423
Comments
Ok, so I tweaked the test to log after the window() node and sure enough that's what the issue is - the data in the recording is sorted by node first, then time and so the window node skips all the records from subsequent nodes. @nathanielc - is there a way to ensure that queries are stored in timestamp sorted order? |
@jonseymour Hmm, is seems odd that a recording is not sorted by time. I thought that was impossible. I'll have to go check. Any way you probably want to groupBy before the window anyway since then the windows will be windowed per group. It shouldn't make a difference but under the hood it will be more efficient. var aggregate = stream
|from()
.database('sampledb')
.retentionPolicy('default')
.measurement('sample')
.groupBy('node')
|window()
.align()
.period(5m)
.every(5m)
|mean('metric1').as('metric1')
|influxDBOut()
.database('sampledb')
.measurement('actual') |
Ok, so I was deceived by the documentation here. The distinction between groupBy() the property of a stream node and groupBy() the chaining method wasn't clear from reading the documentation. (The groupBy() as property isn't really documented, although the example for the chaining method does, somewhat confusingly, include an example of the use of the property syntax). |
@nathanielc I've created a PR against the documentation influxdata/docs.influxdata.com-ARCHIVE#379 to fix the documentation issue. Even if this solution works, it isn't obvious to me why the other solution didn't work. Do you want to leave this issue open until you have had a chance to check why the window() first technique didn't work? |
Yes, let's leave it open.Thanks
|
@jonseymour very interesting test-case thanks. |
I defined this tick script:
My expectation is that when this script ran, it would produce the equivalent of:
However, what actually happened is that only one of the "node" groups was written into "actual" - the other groups were discarded.
Is my expectation of what the groupBy node is meant to do incorrect or is this a bug?
I have a Vagrantfile project that includes test data and reproduces the problem available here: https://github.com/wildducktheories/influxdata-testcase
I was using kapacitor 0.12 and influxdb 0.11
The text was updated successfully, but these errors were encountered: