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

[feature request] SHOW TAG VALUES should accept regex #4532

Closed
beckettsean opened this issue Oct 21, 2015 · 6 comments
Closed

[feature request] SHOW TAG VALUES should accept regex #4532

beckettsean opened this issue Oct 21, 2015 · 6 comments

Comments

@beckettsean
Copy link
Contributor

Right now the syntax is SHOW TAG VALUES WITH KEY IN (<tag_key1>, <tag_key2>,...) which is not congruent with our other queries and doesn't support regular expressions.

How about SHOW TAG VALUES WHERE KEY [=,=~,!=,!~] <tag_key_regex>

@beckettsean beckettsean added this to the 1.0.0 milestone Oct 21, 2015
@beckettsean beckettsean changed the title [feature request] change SHOW TAG VALUES syntax [feature request] SHOW TAG VALUES should accept regex Mar 6, 2016
@jsternberg jsternberg self-assigned this May 5, 2016
@jsternberg
Copy link
Contributor

Should we also modify this to support != and !~? It looks like the current code doesn't support any operator except =.

@beckettsean
Copy link
Contributor Author

@jsternberg I would say yes, this should support the full equals, not-equals, matches, and not-matches operators, just like the WHERE clause. That's what most users would expect.

Is there a tradeoff, other than more complex code, for supporting all of them? Does it impact the query speed?

@jsternberg
Copy link
Contributor

It shouldn't affect the query speed although there's another ticket for improving SHOW TAG VALUES performance. The actual code that executes the query already executes the expression. This would be completely about how we parse the syntax. Should we allow this?

SHOW TAG VALUES WITH KEY = 'region' OR key = 'host'

I would lean towards no personally.

@gunnaraasen
Copy link
Member

I agree support for OR or AND doesn't really make sense in this context. A single binary expression should be sufficient for most cases.

Filtering tag values with a WHERE clause could be useful, e.g.

SHOW TAG VALUES WITH KEY = 'region' WHERE customer = 'bob'

Although I imagine that may be significantly harder to implement and similar results could be obtained by running a SELECT value FROM /.*/ WHERE customer = 'bob' GROUP BY region limit 1.

@beckettsean
Copy link
Contributor Author

@jsternberg any limitations will end up frustrating someone, but since the workaround for that is to just run two queries and consolidate the results I can live with OR being illegal in the WITH clause. In fact, that could be stated as regex: SHOW TAG VALUES WITH KEY =~ /['region','host]/.

I would be okay with SHOW TAG VALUES only allowing a single operator, and then using regex most problems can still be solved. We'll see if any of the edge or corner cases are significant.

jsternberg added a commit that referenced this issue May 9, 2016
…VALUES

This adds support for using regex expressions in SHOW TAG VALUES when
selecting the key. Also supporting the `!=` operation for the
comparison. Now you can do any of the following:

    SHOW TAG VALUES WITH KEY != "region"
    SHOW TAG VALUES WITH KEY =~ /region/
    SHOW TAG VALUES WITH KEY !~ /region/

It also adds a new SetLiteral AST node that will potentially be used in
the future to allow set operations for other comparisons in the future.

Fixes #4532.
@jsternberg
Copy link
Contributor

The PR has been modified to support all of those now. In the future, we might want to support NOT IN, but I don't think it's a priority right now. I also tried to model things so it would be easier to include set support in the future for normal queries.

jsternberg added a commit that referenced this issue May 10, 2016
…VALUES

This adds support for using regex expressions in SHOW TAG VALUES when
selecting the key. Also supporting the `!=` operation for the
comparison. Now you can do any of the following:

    SHOW TAG VALUES WITH KEY != "region"
    SHOW TAG VALUES WITH KEY =~ /region/
    SHOW TAG VALUES WITH KEY !~ /region/

It also adds a new SetLiteral AST node that will potentially be used in
the future to allow set operations for other comparisons in the future.

Fixes #4532.
jsternberg added a commit that referenced this issue May 13, 2016
…VALUES

This adds support for using regex expressions in SHOW TAG VALUES when
selecting the key. Also supporting the `!=` operation for the
comparison. Now you can do any of the following:

    SHOW TAG VALUES WITH KEY != "region"
    SHOW TAG VALUES WITH KEY =~ /region/
    SHOW TAG VALUES WITH KEY !~ /region/

It also adds a new SetLiteral AST node that will potentially be used in
the future to allow set operations for other comparisons in the future.

Fixes #4532.
jsternberg added a commit that referenced this issue May 16, 2016
…VALUES

This adds support for using regex expressions in SHOW TAG VALUES when
selecting the key. Also supporting the `!=` operation for the
comparison. Now you can do any of the following:

    SHOW TAG VALUES WITH KEY != "region"
    SHOW TAG VALUES WITH KEY =~ /region/
    SHOW TAG VALUES WITH KEY !~ /region/

It also adds a new SetLiteral AST node that will potentially be used in
the future to allow set operations for other comparisons in the future.

Fixes #4532.
jsternberg added a commit that referenced this issue May 17, 2016
…VALUES

This adds support for using regex expressions in SHOW TAG VALUES when
selecting the key. Also supporting the `!=` operation for the
comparison. Now you can do any of the following:

    SHOW TAG VALUES WITH KEY != "region"
    SHOW TAG VALUES WITH KEY =~ /region/
    SHOW TAG VALUES WITH KEY !~ /region/

It also adds a new SetLiteral AST node that will potentially be used in
the future to allow set operations for other comparisons in the future.

Fixes #4532.
jsternberg added a commit that referenced this issue May 18, 2016
…VALUES

This adds support for using regex expressions in SHOW TAG VALUES when
selecting the key. Also supporting the `!=` operation for the
comparison. Now you can do any of the following:

    SHOW TAG VALUES WITH KEY != "region"
    SHOW TAG VALUES WITH KEY =~ /region/
    SHOW TAG VALUES WITH KEY !~ /region/

It also adds a new SetLiteral AST node that will potentially be used in
the future to allow set operations for other comparisons in the future.

Fixes #4532.
jsternberg added a commit that referenced this issue May 25, 2016
…VALUES

This adds support for using regex expressions in SHOW TAG VALUES when
selecting the key. Also supporting the `!=` operation for the
comparison. Now you can do any of the following:

    SHOW TAG VALUES WITH KEY != "region"
    SHOW TAG VALUES WITH KEY =~ /region/
    SHOW TAG VALUES WITH KEY !~ /region/

It also adds a new SetLiteral AST node that will potentially be used in
the future to allow set operations for other comparisons in the future.

Fixes #4532.
@jwilder jwilder modified the milestones: 1.0.0 beta, 1.0.0 May 26, 2016
jsternberg added a commit that referenced this issue Jun 9, 2016
…VALUES

This adds support for using regex expressions in SHOW TAG VALUES when
selecting the key. Also supporting the `!=` operation for the
comparison. Now you can do any of the following:

    SHOW TAG VALUES WITH KEY != "region"
    SHOW TAG VALUES WITH KEY =~ /region/
    SHOW TAG VALUES WITH KEY !~ /region/

It also adds a new SetLiteral AST node that will potentially be used in
the future to allow set operations for other comparisons in the future.

Fixes #4532.
jsternberg added a commit that referenced this issue Jun 13, 2016
…VALUES

This adds support for using regex expressions in SHOW TAG VALUES when
selecting the key. Also supporting the `!=` operation for the
comparison. Now you can do any of the following:

    SHOW TAG VALUES WITH KEY != "region"
    SHOW TAG VALUES WITH KEY =~ /region/
    SHOW TAG VALUES WITH KEY !~ /region/

It also adds a new SetLiteral AST node that will potentially be used in
the future to allow set operations for other comparisons in the future.

Fixes #4532.
jsternberg added a commit that referenced this issue Jun 13, 2016
…VALUES

This adds support for using regex expressions in SHOW TAG VALUES when
selecting the key. Also supporting the `!=` operation for the
comparison. Now you can do any of the following:

    SHOW TAG VALUES WITH KEY != "region"
    SHOW TAG VALUES WITH KEY =~ /region/
    SHOW TAG VALUES WITH KEY !~ /region/

It also adds a new SetLiteral AST node that will potentially be used in
the future to allow set operations for other comparisons in the future.

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

No branches or pull requests

5 participants