-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Query planner should validate distinct is passed a field #2612
Comments
Currently, they fail as expected:
However, I suspect once we merge #2598 that it will stop working. If that is the case, I have to wait for that PR to get finished before I can tackle this one? |
I think you can get to this one before that PR gets merged. The validation would still happen in the query planning stage when looking at what is passed into distinct. The only thing I would say is that the error message should be more helpful since there is a way to get at what they're asking for i.e. |
Ok, I was thinking more about testing. I can write a unit test which should be fine, but I won't be able to finish out integration tests which will leave the issue open until the other PR is merged. |
Ah right you are |
Still seems to be working after #2598:
|
There is a distinction between a So now, if you issue either of these queries (where host is a tag, not a field): SELECT distinct(host) FROM cpu
SELECT distinct host FROM cpu You will get an error like:
If you issue a query like this: SELECT count(distinct host) FROM cpu
SELECT count(distinct(host)) FROM cpu You will get the generic message like:
|
that seems fine to me |
@corylanou that looks right. Eventually we'd want them to be able to do a |
When the user does a select distinct query, it should validate that the argument passed to distinct is a field. If it's a tag it should return an error like:
select distinct must be passed a field. To query the unique values for a tag use "show tag values from measurement_name with key = 'key_name'"
Where
measurement_name
andkey_name
are replaced with whatever was in the query.The text was updated successfully, but these errors were encountered: