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

Support empty tags for all WHERE equality operations #6283

Merged
merged 3 commits into from
Apr 11, 2016

Conversation

jsternberg
Copy link
Contributor

A missing tag on a point was sometimes treated as "" and sometimes
treated as a separate null entity. This change modifies the equality
operations to always treat a missing tag as an empty string.

Empty tags are not indexed and do not have the same performance as a tag
that exists.

Also fixes the subset method on tags to behave consistently with empty tags.

Fixes #3773.

@jsternberg
Copy link
Contributor Author

@pauldix here's the change we talked about with regards to empty tags. I'm not sure if we're ok with the lack of indexing for empty tags as I don't really know the use case. The performance change shouldn't affect any existing behavior and should actually make WHERE tag !~ /.*/ faster (due to a weird quirk that the previous code didn't account for).

If a point had no tags at all and was asked for the subset of tags with
at least one key, it would return a new set of tags that was completely
empty. In contrast, if the point had any tags at all, it would return a
set of tags with the tag value being an empty string. This lead to
a point with no tags being treated differently than a point with at
least one tag.

Fixing this so the tag value will always be an empty string for
consistency. A missing tag should always be empty.
A missing tag on a point was sometimes treated as `""` and sometimes
treated as a separate `null` entity. This change modifies the equality
operations to always treat a missing tag as an empty string.

Empty tags are *not* indexed and do not have the same performance as a
tag that exists.

Fixes #3773.
@jsternberg jsternberg force-pushed the js-3773-treat-tags-as-empty-string branch from 7db5691 to c8e23ec Compare April 11, 2016 16:26
@pauldix
Copy link
Member

pauldix commented Apr 11, 2016

👍 other than the test failures

@jsternberg jsternberg force-pushed the js-3773-treat-tags-as-empty-string branch from c8e23ec to 815c49a Compare April 11, 2016 18:00
@jsternberg jsternberg merged commit 6db7db1 into master Apr 11, 2016
@jsternberg jsternberg deleted the js-3773-treat-tags-as-empty-string branch April 11, 2016 18:17
jsternberg added a commit that referenced this pull request Aug 31, 2016
The behavior for querying tag values with an empty string was originally
fixed in #6283, but it also added a performance problem when the
cardinality of the tag was high. Since a call to `Union()` or `Reject()`
would happen for every series key and it would be called N times for N
cardinality, the comparisons against a blank string were unnecessarily
slow with large memory allocations.

This optimizes these queries so it doesn't use those methods anymore.
Those methods are still useful and used when combining AND and OR
clauses, but they aren't useful when finding the series ids for a single
clause. These methods were unnecessary anyway because the series ids for
the tags were unique anyway and didn't have to be merged as a set.
@timhallinflux timhallinflux added this to the 0.13.0 milestone Dec 20, 2016
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

Successfully merging this pull request may close these issues.

[0.9.3-nightly] regexs fails with empty tags
3 participants