-
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
WHERE fields must be decoded during aggregates #4789
Conversation
Real fix for #4701 |
e9a12cb
to
7d0fa41
Compare
Will cherry-pick this to 0.9.5 when merged to master. |
This change ensures that if there are any fields in the WHERE clause of an aggregate that are different from the fields in the SELECT clause, that the cursors also decode those fields. Otherwise WHERE clauses of the form 'SELECT f(w) FROM x WHERE y=z' will return incorrect results Fixes issue #4701.
7d0fa41
to
912684b
Compare
@@ -649,7 +649,7 @@ func (m *AggregateMapper) openMeasurement(mm *Measurement) error { | |||
} | |||
|
|||
for i, key := range t.SeriesKeys { | |||
fields := slices.Union(selectFields, m.fieldNames, false) | |||
fields := slices.Union(slices.Union(selectFields, m.fieldNames, false), m.whereFields, false) |
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.
nit: This looks a little ugly. Future refactoring perhaps?
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.
I actually think it looks good! What could be clearer? :-)
Fix makes sense. +1 |
👍 |
WHERE fields must be decoded during aggregates
This change ensures that if there are any fields in the WHERE clause of an aggregate that are different from the fields in the SELECT clause, that the cursors also decode those fields. Otherwise WHERE clauses of the form
SELECT f(w) FROM x WHERE y=z
will return incorrect results