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

SELECT * behavior should be changed #3549

Closed
pauldix opened this issue Aug 4, 2015 · 4 comments
Closed

SELECT * behavior should be changed #3549

pauldix opened this issue Aug 4, 2015 · 4 comments
Assignees
Milestone

Comments

@pauldix
Copy link
Member

pauldix commented Aug 4, 2015

Currently, if you do a SELECT * query it will do two things.

  1. rewrite the * to have all field names from the measurement
  2. insert a GROUP BY * at then end of the query, which will expand out to all tag keys

This is causing a bunch of confusion and bugs. Instead, SELECT * should select all field values AND it should insert the tag keys and values in the result set.

For example if you have the following data:

cpu,host=A,region=uswest value=23.2 123450
cpu,host=B,region=useast value=65.2 123450
cpu,host=A,region=uswest value=22.3 123460

And you do this query: SELECT * FROM cpu you should get in the result set a single series. The important bit in the response is this:

{
  "columns": ["time", "host", "region", "value"],
  "values": [
    [123450, "A", "uswest", 23.2],
    [123450, "B", "useast", 65.2],
    [123460, "A", "uswest", 22.3]
  ]
}

Note that time is always the first column and the other columns are sorted lexicographically.

The insertion of the tags into the result set will need to happen at the Mapper level since the reducer may or may not know about these.

Ideally, this work will also make it possible to do queries like this:

SELECT value, host from cpu
SELECT min(value), host from cpu
@pauldix pauldix added this to the 0.9.3 milestone Aug 4, 2015
@jacek213
Copy link

jacek213 commented Aug 4, 2015

A little offtopic, but is it currently possible to return time as integer - like in your example?

@pauldix
Copy link
Member Author

pauldix commented Aug 4, 2015

It is, when you make the request add the query parameter epoch=true

@jacek213
Copy link

jacek213 commented Aug 4, 2015

Great news, thanks!

@corylanou corylanou assigned corylanou and unassigned DanielMorsing Aug 6, 2015
@corylanou
Copy link
Contributor

Additional notes:

SELECT value, host from foo group by host, region
then host should be included in the columns
any tag keys they have in the GROUP BY statement, shouldn’t be written into the columns in the case of the SELECT *

select * from foo group by *
No tags in the columns, only group by tags

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

No branches or pull requests

4 participants