{"action":"created","issue":{"url":"https://api.github.com/repos/influxdb/influxdb/issues/5241","labels_url":"https://api.github.com/repos/influxdb/influxdb/issues/5241/labels{/name}","comments_url":"https://api.github.com/repos/influxdb/influxdb/issues/5241/comments","events_url":"https://api.github.com/repos/influxdb/influxdb/issues/5241/events","html_url":"https://github.com/influxdb/influxdb/issues/5241","id":124303226,"number":5241,"title":"Why asymmetric behaviour of tags (column vs. special-and-not-a-column) in JSON query responses?","user":{"login":"bigKS","id":16140156,"avatar_url":"https://avatars.githubusercontent.com/u/16140156?v=3","gravatar_id":"","url":"https://api.github.com/users/bigKS","html_url":"https://github.com/bigKS","followers_url":"https://api.github.com/users/bigKS/followers","following_url":"https://api.github.com/users/bigKS/following{/other_user}","gists_url":"https://api.github.com/users/bigKS/gists{/gist_id}","starred_url":"https://api.github.com/users/bigKS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bigKS/subscriptions","organizations_url":"https://api.github.com/users/bigKS/orgs","repos_url":"https://api.github.com/users/bigKS/repos","events_url":"https://api.github.com/users/bigKS/events{/privacy}","received_events_url":"https://api.github.com/users/bigKS/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-30T04:42:56Z","updated_at":"2016-01-02T02:08:46Z","closed_at":"2015-12-30T20:28:54Z","body":"Where are there two different ways a tag can be tried with a query response?\r\n\r\nSometimes tags are treated as a regular column and show up in the columns fields (and there is no tags field at all) in the JSON response.\r\nAnd...\r\nSometimes the tags are treated as special (and not in the the columns field) and show up in a tags field.\r\n\r\n\r\n\r\n\r\nA) Sometimes (e.g. aggregate functions used) response is split up into multiple \"series\" fields, where each has a tags field:\r\n----------------------------------------------------------\r\n ~]$ curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode \"db=cs\" --data-urlencode \"q=SELECT sum(f1) FROM table where time < now() group by time(1s),t1\"\r\n{\r\n    \"results\": [\r\n        {\r\n            \"series\": [\r\n                {\r\n                    \"name\": \"table\",\r\n                    \"tags\": {\r\n                        \"t1\": \"\\\"hi\\\"\"\r\n                    },\r\n                    \"columns\": [\r\n                        \"time\",\r\n                        \"sum\"\r\n                    ],\r\n                    \"values\": [\r\n                        [\r\n                            \"1970-01-01T00:00:00Z\",\r\n                            8.8\r\n                        ]\r\n                    ]\r\n                },\r\n                {\r\n                    \"name\": \"table\",\r\n                    \"tags\": {\r\n                        \"t1\": \"\\\"jello\\\"\"\r\n                    },\r\n                    \"columns\": [\r\n                        \"time\",\r\n                        \"sum\"\r\n                    ],\r\n                    \"values\": [\r\n                        [\r\n                            \"1970-01-01T00:00:00Z\",\r\n                            1991.1999999999994\r\n                        ]\r\n                    ]\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}\r\n\r\nB) But most of the cases there is no tags field in response, but the tags are buried within the columns fields:\r\n---------------------------------------------------------------------------\r\n\r\n~]$ curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode \"db=cs\" --data-urlencode \"q=SELECT * FROM table\"\r\n{\r\n    \"results\": [\r\n        {\r\n            \"series\": [\r\n                {\r\n                    \"name\": \"table\",\r\n                    \"columns\": [\r\n                        \"time\",\r\n                        \"f1\",\r\n                        \"f2\",\r\n                        \"t1\",\r\n                        \"t2\"\r\n                    ],\r\n                    \"values\": [\r\n                        [\r\n                            \"2005-07-15T16:51:56.098433058Z\",\r\n                            52.12,\r\n                            1232.1,\r\n                            \"\\\"jello\\\"\",\r\n                            \"\\\"bye\\\"\"\r\n                        ],\r\n                        [\r\n                            \"2015-01-16T22:11:56.098433058Z\",\r\n                            52.12,\r\n                            1232.1,\r\n                            \"\\\"jello\\\"\",\r\n                            \"\\\"bye\\\"\"\r\n                        ],\r\n                        [\r\n                            \"2015-12-30T03:09:46.236058993Z\",\r\n                            3.4,\r\n                            9.6,\r\n                            \"\\\"hi\\\"\",\r\n                            \"\\\"bye\\\"\"\r\n                        ],\r\n                        [\r\n                            \"2015-12-30T03:10:12.293548087Z\",\r\n                            5.4,\r\n                            10.2,\r\n                            \"\\\"hi\\\"\",\r\n                            \"\\\"hasta luego\\\"\"\r\n                        ],\r\n                        [\r\n                            \"2015-12-30T03:31:30.887919382Z\",\r\n                            542.12,\r\n                            1232.1,\r\n                            \"\\\"jello\\\"\",\r\n                            \"\\\"bye\\\"\"\r\n                        ],\r\n                        [\r\n                            \"2015-12-30T03:31:56.098433058Z\",\r\n                            542.12,\r\n                            1232.1,\r\n                            \"\\\"jello\\\"\",\r\n                            \"\\\"bye\\\"\"\r\n                        ],\r\n                        [\r\n                            \"2015-12-30T03:31:56.650898083Z\",\r\n                            542.12,\r\n                            1232.1,\r\n                            \"\\\"jello\\\"\",\r\n                            \"\\\"bye\\\"\"\r\n                        ],\r\n                        [\r\n                            \"2015-12-30T03:32:37.556795537Z\",\r\n                            52.12,\r\n                            1232.1,\r\n                            \"\\\"jello\\\"\",\r\n                            \"\\\"bye\\\"\"\r\n                        ],\r\n                        [\r\n                            \"2015-12-30T03:32:43.167551377Z\",\r\n                            52.12,\r\n                            122.1,\r\n                            \"\\\"jello\\\"\",\r\n                            \"\\\"bye\\\"\"\r\n                        ],\r\n                        [\r\n                            \"2015-12-30T03:32:44.684432633Z\",\r\n                            52.12,\r\n                            1232.1,\r\n                            \"\\\"jello\\\"\",\r\n                            \"\\\"bye\\\"\"\r\n                        ],\r\n                        [\r\n                            \"2015-12-30T04:12:59.773062901Z\",\r\n                            52.12,\r\n                            122.1,\r\n                            \"\\\"jello\\\"\",\r\n                            \"\\\"bye\\\"\"\r\n                        ],\r\n                        [\r\n                            \"2015-12-30T04:13:05.152630207Z\",\r\n                            52.12,\r\n                            0.12,\r\n                            \"\\\"jello\\\"\",\r\n                            \"\\\"bye\\\"\"\r\n                        ]\r\n                    ]\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}\r\n\r\n\r\nVERSION INFO:\r\n-----------------------------\r\n~]$ influx\r\nVisit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring.\r\nConnected to http://localhost:8086 version 0.9.5.1\r\nInfluxDB shell 0.9.5.1"},"comment":{"url":"https://api.github.com/repos/influxdb/influxdb/issues/comments/168357291","html_url":"https://github.com/influxdb/influxdb/issues/5241#issuecomment-168357291","issue_url":"https://api.github.com/repos/influxdb/influxdb/issues/5241","id":168357291,"user":{"login":"bigKS","id":16140156,"avatar_url":"https://avatars.githubusercontent.com/u/16140156?v=3","gravatar_id":"","url":"https://api.github.com/users/bigKS","html_url":"https://github.com/bigKS","followers_url":"https://api.github.com/users/bigKS/followers","following_url":"https://api.github.com/users/bigKS/following{/other_user}","gists_url":"https://api.github.com/users/bigKS/gists{/gist_id}","starred_url":"https://api.github.com/users/bigKS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bigKS/subscriptions","organizations_url":"https://api.github.com/users/bigKS/orgs","repos_url":"https://api.github.com/users/bigKS/repos","events_url":"https://api.github.com/users/bigKS/events{/privacy}","received_events_url":"https://api.github.com/users/bigKS/received_events","type":"User","site_admin":false},"created_at":"2016-01-02T02:08:46Z","updated_at":"2016-01-02T02:08:46Z","body":"Now the meaning of \"columns\" in the query responses is not well defined. Sometimes it includes tags, sometimes it does not (in which case, multiple series are returned with an extra 'tags' section in the responses)."}}