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

feat: make sure the query plan nodes have unique ids #3297

Merged
merged 5 commits into from
Nov 2, 2020

Conversation

ethanyzhang
Copy link
Contributor

A lot of our planner rules transform the existing plan nodes into completely different ones. For example, PushDownGroupAggregateRule collapses range |> window |> agg into ReadWindowAggregate.

In this process, we usually manually create the new physical nodes without numbering them. So if such planner rules are applied more than once in a query (a query with join or table functions or chain()), the plan nodes those rules created will have the same node ID and thus the same dataset ID. This will confuse the execution engine and generate undefined results.

This PR addresses it by introducing a new CreateUniquePhysicalNode method that can read the next plan node ID from the context and apply it.

@codecov-io
Copy link

codecov-io commented Nov 2, 2020

Codecov Report

Merging #3297 into master will increase coverage by 0.00%.
The diff coverage is 37.50%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3297   +/-   ##
=======================================
  Coverage   49.35%   49.35%           
=======================================
  Files         351      351           
  Lines       36379    36393   +14     
=======================================
+ Hits        17954    17962    +8     
- Misses      15904    15908    +4     
- Partials     2521     2523    +2     
Impacted Files Coverage Δ
internal/spec/build.go 0.00% <0.00%> (ø)
plan/physical.go 62.36% <0.00%> (-4.31%) ⬇️
stdlib/influxdata/influxdb/v1/rules.go 12.50% <0.00%> (ø)
execute/profiler.go 83.70% <100.00%> (+0.07%) ⬆️
lang/compiler.go 71.25% <100.00%> (+0.64%) ⬆️
stdlib/influxdata/influxdb/rules.go 80.00% <100.00%> (+5.71%) ⬆️
stdlib/universe/pivot.gen.go 9.66% <0.00%> (-0.27%) ⬇️
stdlib/influxdata/influxdb/buckets.go 48.38% <0.00%> (+1.61%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 15923a0...3f1cd77. Read the comment docs.

Copy link
Contributor

@rockstar rockstar left a comment

Choose a reason for hiding this comment

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

Thanks for the description here. I had assumed something similar, but I'm glad to see it explicit. Also, this patch looks much more narrow than the previous one, and can fit in my brain a lot better. Thanks for doing that for me. Let's go ahead and merge this here good work.

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.

3 participants