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

tags not returned in query result #1696

Closed
dashesy opened this issue Feb 23, 2015 · 11 comments
Closed

tags not returned in query result #1696

dashesy opened this issue Feb 23, 2015 · 11 comments

Comments

@dashesy
Copy link

dashesy commented Feb 23, 2015

I create 2 records like this:

'{"points": [{"timestamp": 1422921600000, "tags": {"pk": "pk1"}, "values": {"value": 1}, "name": "my.test", "precision": "ms"}, {"timestamp": 1423008000000, "tags": {"pk": "pk2"}, "values": {"value": 2}, "name": "my.test", "precision": "ms"}], "precision": "ms", "database": "processed"}'

There are 2 tags one for each record, now I query the series with 'select * from my.test' and this is what is returned:

'{"results":[{"rows":[{"name":"my.test","columns":["time","value"],"values":[["2015-02-04T00:00:00Z",2],["2015-02-03T00:00:00Z",1]]}]}]}'

There is no mention of tags.

@pauldix
Copy link
Member

pauldix commented Feb 24, 2015

This is fixed by #1632 and in rc3

@pauldix pauldix closed this as completed Feb 24, 2015
@dashesy
Copy link
Author

dashesy commented Feb 25, 2015

I tried both rc3 and rc4 and I still do not get tags back, of course now it is using fields instead of values (nice change BTW):

'{"points": [{"fields": {"value": 1}, "tags": {"pk": "pk1"}, "name": "my.test", "timestamp": 1422921600000, "precision": "ms"}, {"fields": {"value": 2}, "tags": {"pk": "pk2"}, "name": "my.test", "timestamp": 1423008000000, "precision": "ms"}], "precision": "ms", "database": "processed"}'

and it returns series (also a better name) but still no tags there:

'{"results":[{"series":[{"name":"my.test","columns":["time","value"],"values":[["2015-02-03T00:00:00Z",1],["2015-02-04T00:00:00Z",2]]}]}]}

@dashesy
Copy link
Author

dashesy commented Feb 25, 2015

It seems tags are not used, select value from my.test where pk=pk1 returns empty and select value from my.test also does not return tags.

@otoolep
Copy link
Contributor

otoolep commented Feb 25, 2015

@dashesy -- can you please provide a complete script, which uses curl, that demonstrates this issue?

@dashesy
Copy link
Author

dashesy commented Feb 25, 2015

Here is what I did to see latest master:

rm ~/xdev/gocodez/bin/influxd
rm -rf ~/.influxdb/
go get -u -f ./...
go build ./...
~/xdev/gocodez/bin/influxd -config /home/dashesy/influxdb.conf

Then build db:

curl -G 'http://localhost:8086/query' --data-urlencode "q=create database mydb"
curl -G 'http://localhost:8086/query' --data-urlencode "q=CREATE RETENTION POLICY mypolicy ON mydb duration 7d REPLICATION 1 DEFAULT"

Then add 2 records:

curl -XPOST 'http://localhost:8086/write' -d '{"points": [{"fields": {"value": 1}, "tags": {"pk": "pk1"}, "name": "test", "timestamp": 1422921600000, "precision": "ms"}, {"fields": {"value": 2}, "tags": {"pk": "pk2"}, "name": "test", "timestamp": 1423008000000, "precision": "ms"}], "precision": "ms", "database": "mydb"}'

Then query:

curl -G 'http://localhost:8086/query' --data-urlencode "q=select value from test" --data-urlencode "db=mydb

And this is the results (no tags):

{"results":[{"series":[{"name":"test","columns":["time","value"],"values":[["2015-02-03T00:00:00Z",1],["2015-02-04T00:00:00Z",2]]}]}]}

This was for the sake of this test but when I use my Pandas library here I see same results.

@otoolep
Copy link
Contributor

otoolep commented Feb 25, 2015

I am seeing this with RC4. @pauldix

@otoolep otoolep reopened this Feb 25, 2015
@pauldix
Copy link
Member

pauldix commented Feb 27, 2015

@dashesy Can you try this again with RC6? Also, if you want the tags returned, you'll have to group by them either explicitly:

select value from foo group by someTag

Or do this

select value from foo group by *

@dashesy
Copy link
Author

dashesy commented Feb 28, 2015

@pauldix Yes it works now! I can now start using InfluxDB more seriously, thanks.
Looking at the docs here I think the docs should explain how tags are treated, that only those that get mentioned in group by or where clause will be returned (if this is your design intention). I like this minimalist design. Since the only valid identifier after select (other than regexp) is literal value another way would be something like: select value, tags from foo to use group by with something more useful like time bins.

@pauldix pauldix closed this as completed Feb 28, 2015
@pauldix
Copy link
Member

pauldix commented Feb 28, 2015

@dashesy good to hear. I added issue #1798 which would take care of this. I think that'll give the expected result since it sounds like that's what you ultimately wanted. Was a series for each of those tag keys.

@KrishnaPG
Copy link

I am encountering the same problem (with 0.9.1 stable version), and trying to get the RC6 as suggested above - but couldn't find it in the downloads page here

Is it the Version 0.9.3 (Nightly) that has this fix?

@KrishnaPG
Copy link

I am sorry - please ignore my previous question. I was checking the results in the admin (web) interface and it was only showing the fields (and not tags) in the html table. But when looked at the curl results, looks like the data has the tags specified properly in the stable version (0.9.1). Thanks for supporting it.

mark-rushakoff pushed a commit that referenced this issue Jan 11, 2019
…gress-bar

Add completion step to progress bar in onboarding wizard
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