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

Implement tag support in SELECT statements #2598

Merged
merged 4 commits into from
May 20, 2015
Merged

Implement tag support in SELECT statements #2598

merged 4 commits into from
May 20, 2015

Conversation

toddboom
Copy link
Contributor

Fixes #1989 and #2499.

@toddboom toddboom force-pushed the select-tag-keys branch 2 times, most recently from f5d89d4 to 5eaec30 Compare May 19, 2015 07:01
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]]}]}]}`,
Copy link
Member

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?

@toddboom toddboom changed the title Select tag keys Implement tag support in SELECT statements May 20, 2015
@pauldix
Copy link
Member

pauldix commented May 20, 2015

+1

// since selectNames can contain tags, we need to strip them out
selectFields := make([]string, 0, len(selectNames))

for _, n := range selectNames {
Copy link
Contributor

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) 
   }                                        
 }                                          

Copy link
Contributor Author

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.

@corylanou
Copy link
Contributor

Minor feedback, looks great. +1 :shipit:

toddboom added a commit that referenced this pull request May 20, 2015
Implement tag support in SELECT statements
@toddboom toddboom merged commit 01fb935 into master May 20, 2015
@toddboom toddboom deleted the select-tag-keys branch May 20, 2015 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implement SELECT tagName FROM m
3 participants