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

fix: forward-port changes to tag values/key for better predicate handling #22500

Merged
merged 5 commits into from
Sep 17, 2021

Conversation

williamhbaker
Copy link
Contributor

Closes #22385
Partial forward port of #20793
Partially closes #22499

This ports the changes made in #20793 to the TSDB's handling of predicate expressions, which fixes the bug with querying for tag values with a non-trivial predicate.

The InfluxQL changes are not being ported, since this would introduce a divergence between InfluxQL on 2.x and cloud. A feature request has been opened for adding support for this query to cloud, and depending on that decision the rest of the code could be ported. For now, only the changes to the TSDB are being ported to fix #22385.

@@ -0,0 +1,128 @@
package influxdb_test
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are included here to show that the changes do fix #22385, but should be moved to the Flux repo when this merges and later removed when we update to a version of flux that includes these tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a good TODO comment to put in the test itself.

@williamhbaker williamhbaker requested a review from lesam September 16, 2021 21:44
@@ -108,7 +108,7 @@ require (
github.com/influxdata/httprouter v1.3.1-0.20191122104820-ee83e2772f69
github.com/influxdata/influx-cli/v2 v2.1.1-0.20210813175002-13799e7662c0
github.com/influxdata/influxdb-client-go/v2 v2.3.1-0.20210518120617-5d1fff431040 // indirect
github.com/influxdata/influxql v0.0.0-20180925231337-1cbfca8e56b6
github.com/influxdata/influxql v1.1.1-0.20210223160523-b6ab99450c93
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any other meaningful changes this pulls in?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also do we need this change if we're not pulling in the WITH KEY work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we should probably have an issue to forward-port WITH KEY so we can keep track of what's done/not done/why.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumping the InfluxQL version was necessary to be able to use the PartitionExpr from the InfluxQL package which was added recently. That's what really does the magic that fixes the tag values metaquery issue.

I created an issue for forwarding porting this and added a comment explaining what this PR partially ports: #22499

As far as InfluxQL changes, there's only a few - a couple of which seem somewhat meaningful:

Other than that, there's a go version update, optimization to use strings.Builder, and a simple fix to code comments - I wouldn't think these would have much user impact.

I suppose it would be good to have the CHANGELOG reflect these changes, although I'm not sure how that will work with the new changelog automation system.

Alternatively, I could just port the code out of InfluxQL in [this file](https://github.com/influxdata/influxql/blob/master/utils.go] into InfluxDB somewhere and use it that way. Do you have any strong feelings either way?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we just take the influxql upgrade and call the version change out in the release notes.

Copy link
Contributor

@lesam lesam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@williamhbaker williamhbaker merged commit 1f66b31 into master Sep 17, 2021
@williamhbaker williamhbaker deleted the wb-port-tag-values-with-key-22499 branch September 17, 2021 17:14
williamhbaker added a commit that referenced this pull request Sep 17, 2021
…show tag values metaqueries (#22500)

* feat: Add WITH KEY to show tag keys

* fix: add tests for multi measurement tag value queries

* chore: fix linter problems

* chore: revert influxql changes to keep WITH KEY disabled

* chore: add TODO for moving flux tests to flux repo

Co-authored-by: Sam Arnold <sarnold@influxdata.com>
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.

[forward port 2.x] Add WITH syntax to SHOW TAG KEYS Bug in schema.tagValues function
2 participants