__System info:__
InfluxDB 1.0.2
Ubuntu 16.04.1 LTS
__Steps to reproduce:__
insert some data
insert m1,t1=aa f1=6.3,f2=11.34
insert m1,t1=aa f1=6.2,f2=20.26
insert m1,t1=aa f1=3.1,f2=51.24
insert m1,t1=aa f1=2.4,f2=20.36
insert m1,t1=aa f1=1.5,f2=11.24
insert m1,t1=aa f1=9.6,f2=0.26
insert m1,t1=ab f1=8.7,f2=17.25
insert m1,t1=ab f1=5.8,f2=81.24
insert m1,t1=ab f1=7.9,f2=11.23
insert m1,t1=ab f1=5.1,f2=10.22
insert m1,t1=ab f1=7.2,f2=11.21
insert m1,t1=ab f1=5.3,f2=10.3
run these queries
a) select t1,max(f1),min(f2) from m1 group by t1
b) select t1,max(f1),min(f2) from m1 where t1='aa'
__Expected behavior:__
In both cases, t1 should be available to select.
a) The group by clause segments the returned rows into subsets with identical characteristics. In this case each subset must have an identical t1. Hence t1 should be selectable and reported for each subset of rows. This is SQL standard.
b) By restricting all returned rows to a specific tag (in the case of the where clause), t1 has a constant value for the entire set of rows examined. The set functions max and min return results about the set of rows. t1 is also a known fact about the set of rows. This is non-Standard SQL.
__Actual behavior:__ [What actually happened]
ERR: error parsing query: mixing multiple selector functions with tags or fields is not supported
Since you are using two selectors at the same time, you can't select tags or fields with the selector. This is because the query wouldn't be able to figure out if it was supposed to select the field/tag related to the first selector or the second selector.
This is working as expected.
Hi @jsternberg
it was supposed to select the field/tag related to the first selector or the second selector.
While I understand there are implementation details that make this non-trivial, but from a standpoint of sql user, I think we can safely assume it was supposed to select tag related to group by? at least in the case of a) as outlined by @inselbuch .
Or what alternatives would you propose for the query?
select t1,max(f1),min(f2) from m1 group by t1;
Most helpful comment
Hi @jsternberg
While I understand there are implementation details that make this non-trivial, but from a standpoint of sql user, I think we can safely assume
it was supposed to select tag related to group by? at least in the case of a) as outlined by @inselbuch .Or what alternatives would you propose for the query?