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(plan): fix logic bug in planner helper method #5115

Merged
merged 2 commits into from
Aug 19, 2022

Conversation

wolffcm
Copy link

@wolffcm wolffcm commented Aug 19, 2022

Fixes #5114.

This PR addresses an issue that has existed for a long time, but did not manifest until #5047 was merged.

The issue was in a plan helper method that merges two nodes. If the predecessor to one of the nodes had a predecessor with multiple successors, we were not updating edges correctly and we put the plan graph into an inconsistent state.

Previously this issue could not be hit because we did not allow many rules to match in multi-successor scenarios, and this bug is particular to that situation.

Checklist

Dear Author 👋, the following checks should be completed (or explicitly dismissed) before merging.

  • ✏️ Write a PR description, regardless of triviality, to include the value of this PR
  • 🔗 Reference related issues
  • 🏃 Test cases are included to exercise the new code
  • 🧪 If new packages are being introduced to stdlib, link to Working Group discussion notes and ensure it lands under experimental/ (N/A)
  • 📖 If language features are changing, ensure docs/Spec.md has been updated (N/A)

Dear Reviewer(s) 👋, you are responsible (among others) for ensuring the completeness and quality of the above before approval.

@wolffcm wolffcm requested a review from a team as a code owner August 19, 2022 18:36
@wolffcm wolffcm requested review from scbrickley and removed request for a team August 19, 2022 18:36
Comment on lines +268 to +269
for _, pred := range merged.Predecessors() {
for i, succ := range pred.Successors() {
Copy link
Contributor

Choose a reason for hiding this comment

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

So the bug was caused by this code block using the wrong index? Do I have that right?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that's right. We are looking at the predecessors of the node being replaced, and updating them to point at the new node. But we were using the index from the list of predecessors (which we are not changing) instead of the index from the predecessors' successors.

@wolffcm wolffcm merged commit ac9b827 into master Aug 19, 2022
@wolffcm wolffcm deleted the fix/sort-limit-planner-rule branch August 19, 2022 19:06
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.

Plan integrity violated when apply sort |> limit rule
2 participants