-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
release-22.2.0: opt: fix WithScan errors in apply-joins #89856
release-22.2.0: opt: fix WithScan errors in apply-joins #89856
Conversation
In #88396, we updated the planning logic for the RHS of apply-joins so that all With expressions in the original memo's metadata are added to the metadata of the new, temporary memo. This change was brittle. It relied on the memo's `curWithID` to enumerate all With expressions in the metadata, but it did not propagate the same `curWithID` to the new temporary memo. This caused internal errors with nested apply-joins, because the With expression would not propagate to the inner-most memo's metadata. This commit fixes the issue by removing the dependence on `curWithID`, and directly iterating over all With expressions to add them to the new metadata for the RHS of apply-joins. Fixes #89601 Release note (bug fix): A bug has been fixed that caused internal errors in rare cases when running CTEs (statements with WITH clauses). This bug is only present in v22.2.0-beta.2, v22.2.0-beta.3, v21.2.16, and v22.1.9.
feeaa45
to
a95204a
Compare
Thanks for opening a backport. Please check the backport criteria before merging:
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
Add a brief release justification to the body of your PR to justify this backport. Some other things to consider:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 1 of 0 LGTMs obtained (waiting on @michae2 and @msirek)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status:complete! 2 of 0 LGTMs obtained (waiting on @michae2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status:complete! 3 of 0 LGTMs obtained (waiting on @michae2)
Backport 1/1 commits from #89830 on behalf of @mgartner.
/cc @cockroachdb/release
In #88396, we updated the planning logic for the RHS of apply-joins so that all With expressions in the original memo's metadata are added to the metadata of the new, temporary memo. This change was brittle. It relied on the memo's
curWithID
to enumerate all With expressions in the metadata, but it did not propagate the samecurWithID
to the new temporary memo. This caused internal errors with nested apply-joins, because the With expression would not propagate to the inner-most memo's metadata.This commit fixes the issue by removing the dependence on
curWithID
, and directly iterating over all With expressions to add them to the new metadata for the RHS of apply-joins.Fixes #89601
Release note (bug fix): A bug has been fixed that caused internal errors in rare cases when running CTEs (statements with WITH clauses). This bug is only present in v22.2.0-beta.2, v22.2.0-beta.3, v21.2.16, and v22.1.9.
Release justification: Fixes recent regression in apply-join planning.