-
Notifications
You must be signed in to change notification settings - Fork 875
[ES-2763] [COR-51] Fix crash on nested subqueries with modification #22157
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
base: devel
Are you sure you want to change the base?
Conversation
5bf37dc to
8867a41
Compare
643965f to
b1d4825
Compare
6feba92 to
5100f56
Compare
| // TODO: the original sideEffectShadowRowForwarding returns | ||
| // ExecState::DONE in this case. It is likely correct | ||
| // to just return ExecState::NEXTSUBQUERY and remove this | ||
| // case distinction. | ||
| // Let's do that in a separate PR. In particular keep UPSERT in mind. | ||
| if constexpr (executorHasSideEffects<Executor>) { | ||
| return ExecState::DONE; | ||
| } else { |
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.
If we want to address this in a follow-up PR I suggest we create a ticket and reference it here.
| return shadowRowForwardingSubqueryStart(stack); | ||
| } else if constexpr (std::is_same_v<Executor, SubqueryEndExecutor>) { | ||
| return shadowRowForwardingSubqueryEnd(stack); | ||
| } else { |
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.
I think we should leave this else here in place.
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.
I am not sure I understand; you mean wrap the whole rest of the function into the {} after the else?
Scope & Purpose
Customer reported problems when executing a complex query that involved modification operations inside nested subqueries.
The added regression test shows that the problem occurs when a modification executor is nested within 3 subqueries.
During AQL execution, modification executors are special: they always request to see all their inputs, even if a subsequent
LIMITwould otherwise mean that rows aren't fetched.At some point during execution, it can happen that a subquery call on the modification executors' callstack is empty.
Execution then runs into an assertion on current
devel, because the check whether the modification executor needs to be handled specially duringsideEffectShadowRowForwardingtries to peek the next call of the call stack at every level (inneedToCountSubquery).This solution merges
shadowRowForwardingandsideEffectShadowRowForwardinginto one function that handles the side effect case inline; I hope that makes it slightly more transparent.When the callstack contains an empty call, the executor cannot know what to do, so it is not allowed to do anything and just returns
ExecState::DONEnow.Checklist