physicalplan: preevaluate subqueries on LocalExprs and always set LocalExprs#49891
Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom Jun 10, 2020
Merged
physicalplan: preevaluate subqueries on LocalExprs and always set LocalExprs#49891craig[bot] merged 3 commits intocockroachdb:masterfrom
craig[bot] merged 3 commits intocockroachdb:masterfrom
Conversation
Member
0a4f2c0 to
e19e92a
Compare
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
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
71f7c9d to
fc09ef9
Compare
asubiotto
approved these changes
Jun 10, 2020
Contributor
asubiotto
left a comment
There was a problem hiding this comment.
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)
Member
Author
|
TFTR! bors r+ |
Contributor
Build succeeded |
This file contains hidden or 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
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.Subqueryin 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.ExprHelperthat helps with expressionprocessing. Previously, we were allocating a new
execinfra.ExprHelperand were calling
Initon 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
SupportsVectorizedcheck 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
LocalExpron the gateway even if the plan is distributed.And this commit adds such behavior.
Fixes: #49810.
Release note: None