-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
physicalplan: preevaluate subqueries on LocalExprs and always set LocalExprs #49891
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yuzefovich
force-pushed
the
eval-subquery
branch
4 times, most recently
from
June 5, 2020 03:41
0a4f2c0
to
e19e92a
Compare
yuzefovich
changed the title
WIP physicalplan: preevaluate subqueries on LocalExprs
physicalplan: preevaluate subqueries on LocalExprs and always set LocalExprs
Jun 5, 2020
yuzefovich
force-pushed
the
eval-subquery
branch
4 times, most recently
from
June 10, 2020 03:07
ee33247
to
5310962
Compare
When the plan is local, we do not serialize expressions. Previously, in such a case we would also not preevaluate the subqueries in the expressions which made `EXPLAIN (VEC)` return unexpected plan (there would `tree.Subquery` in the expression which we don't support in the vectorized, so we would wrap the plan). Now we will preevalute the subqueries before storing in the processor spec. AFAICT it affects only this explain variant and nothing else. Release note: None
yuzefovich
force-pushed
the
eval-subquery
branch
from
June 10, 2020 03:12
5310962
to
71f7c9d
Compare
This commit introduces `colexec.ExprHelper` that helps with expression processing. Previously, we were allocating a new `execinfra.ExprHelper` and were calling `Init` on it in order to get the typed expression from possibly serialized representation of each expression. Now, this new expression helper is reused between all expressions in the flow on a single node. There is one caveat, however: we need to make sure that we force deserialization of the expressions during `SupportsVectorized` check if the flow is scheduled to be run on a remote node (different from the one that is performing the check). This is necessary to make sure that the remote nodes will be able to deserialize the expressions without encountering errors (if we don't force the serialization during the check, we will use `LocalExpr` - if available - and might not catch things that we don't support). Release note: None
Previously, we would set either `LocalExpr` (unserialized expression, only we have the full plan on a single node) or `Expr` (serialized expression, when we have distributed plan as well as in some tests). However, we could be setting both and making best effort to reuse unserialized `LocalExpr` on the gateway even if the plan is distributed. And this commit adds such behavior. Release note: None
yuzefovich
force-pushed
the
eval-subquery
branch
from
June 10, 2020 04:47
71f7c9d
to
fc09ef9
Compare
asubiotto
approved these changes
Jun 10, 2020
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 2 of 2 files at r1, 8 of 8 files at r2, 6 of 6 files at r3.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @jordanlewis)
TFTR! bors r+ |
Build succeeded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
physicalplan: preevaluate subqueries on LocalExprs
When the plan is local, we do not serialize expressions. Previously, in
such a case we would also not preevaluate the subqueries in the
expressions which made
EXPLAIN (VEC)
return unexpected plan (therewould
tree.Subquery
in the expression which we don't support in thevectorized, so we would wrap the plan). Now we will preevalute the
subqueries before storing in the processor spec. AFAICT it affects only
this explain variant and nothing else.
Release note: None
colexec: improve expression parsing
This commit introduces
colexec.ExprHelper
that helps with expressionprocessing. Previously, we were allocating a new
execinfra.ExprHelper
and were calling
Init
on it in order to get the typed expression frompossibly serialized representation of each expression. Now, this new
expression helper is reused between all expressions in the flow on
a single node.
There is one caveat, however: we need to make sure that we force
deserialization of the expressions during
SupportsVectorized
check ifthe flow is scheduled to be run on a remote node (different from the one
that is performing the check). This is necessary to make sure that the
remote nodes will be able to deserialize the expressions without
encountering errors (if we don't force the serialization during the
check, we will use
LocalExpr
- if available - and might not catchthings that we don't support).
Release note: None
physicalplan: always store LocalExpr
Previously, we would set either
LocalExpr
(unserialized expression,only when we have the full plan on a single node) or
Expr
(serializedexpression, when we have distributed plan as well as in some tests).
However, we could be setting both and making best effort to reuse
unserialized
LocalExpr
on the gateway even if the plan is distributed.And this commit adds such behavior.
Fixes: #49810.
Release note: None