-
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
Implement tag support in SELECT statements #2598
Conversation
f5d89d4
to
5eaec30
Compare
expected: `{"results":[{"series":[{"name":"cpu","columns":["time","value"],"values":[["2015-02-28T01:03:36.703820946Z",100]]}]},{"series":[{"name":"cpu","columns":["time","value"],"values":[["2015-02-28T01:03:36.703820946Z",100]]}]}]}`, | ||
name: "selecting a tag and a field", | ||
query: `SELECT host, value FROM "%DB%"."%RP%".gpu`, | ||
expected: `{"results":[{"series":[{"name":"gpu","tags":{"host":"server01"},"columns":["time","value"],"values":[["2015-02-28T01:03:36.703820946Z",100]]}]}]}`, |
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.
Can you update this test so it has two data points from different hosts?
+1 |
// since selectNames can contain tags, we need to strip them out | ||
selectFields := make([]string, 0, len(selectNames)) | ||
|
||
for _, n := range selectNames { |
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 think you can shorten this to:
for _, n := range selectNames {
if _, found := m.TagSet.Tags[n]; !found {
selectFields = append(selectFields, n)
}
}
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, plz! doing it now.
Minor feedback, looks great. +1 |
Implement tag support in SELECT statements
Fixes #1989 and #2499.