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

[0.9.3] can not group by tag with period in the name #4018

Closed
airyland opened this issue Sep 5, 2015 · 6 comments
Closed

[0.9.3] can not group by tag with period in the name #4018

airyland opened this issue Sep 5, 2015 · 6 comments
Labels
Milestone

Comments

@airyland
Copy link

airyland commented Sep 5, 2015

I used page.group as tag key, but couldn't group by "page.group".

Server returned:

select sum(page.value) from page group by "page.group"

{"results":[{"series":[{"name":"page","tags":{"page.\"group\"":""},"columns":["time","sum"],"values":[["1970-01-01T00:00:00Z",1696]]}]}]}

image

@beckettsean
Copy link
Contributor

@airyland is page.group a field or a tag? GROUP BY currently only supports tags.

@beckettsean
Copy link
Contributor

Also you need to double-quote page.value in the SELECT clause.

@airyland
Copy link
Author

airyland commented Sep 8, 2015

page.group is a tag.

select * from page

time                                                        page.group  page.value
2015-09-08T21:03:32.725988377Z     "hello"          1
2015-09-08T21:04:09.66892902Z      "hello2"         1
select sum("page.value") from page group by "page.group"

{"results":[{"series":[{"name":"page","tags":{"page.\"group\"":""},"columns":["time","sum"],"values":[["1970-01-01T00:00:00Z",2]]}]}]}
SHOW TAG KEYS FROM page

{"results":[{"series":[{"name":"page","columns":["tagKey"],"values":[["page.group"]]}]}]}

@beckettsean beckettsean changed the title can not group by "page.group"? [0.9.3] can not group by tag with period in the name Sep 8, 2015
@beckettsean
Copy link
Contributor

The problem is caused by the period in the tag name. Without the period everything works as intended.

Repro steps:

> insert page,page.group=hello page.value=1
> insert page,page.group=hello2 page.value=1
> select * from page
name: page
----------
time                page.group  page.value
2015-09-08T22:43:01.622617072Z  hello       1
2015-09-08T22:43:05.839069738Z  hello2      1

> select sum("page.value") from page group by "page.group"
name: page
tags: page."group"=
time            sum
----            ---
1970-01-01T00:00:00Z    2

That last query should have returned two buckets for page.group, but instead it's using page."group", which is a tag that doesn't exist. My best guess is the retention policy parsing is interfering, despite the tag key being double-quoted.

Here's the same data using a tag key without periods, and it works as expected (including the grouping where the tag is not set, which is what we see with the tag that has a period.)

> insert page,pagegroup=hello2 page.value=1
> insert page,pagegroup=hello1 page.value=1
> select sum("page.value") from page group by "pagegroup"
name: page
tags: pagegroup=
time            sum
----            ---
1970-01-01T00:00:00Z    2


name: page
tags: pagegroup=hello1
time            sum
----            ---
1970-01-01T00:00:00Z    1


name: page
tags: pagegroup=hello2
time            sum
----            ---
1970-01-01T00:00:00Z    1

> 

@corylanou
Copy link
Contributor

This appears to be fixed now:

> insert page,page.group=hello page.value=1
> insert page,page.group=hello2 page.value=1
> select * from page
name: page
----------
time                            page.group      page.value
2015-11-17T18:14:46.497801849Z  hello           1
2015-11-17T18:14:52.873958535Z  hello2          1

> select sum("page.value") from page group by "page.group"
name: page
tags: page.group=hello
time                    sum
----                    ---
1970-01-01T00:00:00Z    1


name: page
tags: page.group=hello2
time                    sum
----                    ---
1970-01-01T00:00:00Z    1

Also confirmed admin shows proper results.
screenshot 2015-11-17 12 17 32

@beckettsean can you confirm my results? I want to make sure I understood the problem correctly.

@beckettsean
Copy link
Contributor

@corylanou confirmed fixed in 0.9.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants