-
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
sql/sem/tree: run TestEval with vectorize=experimental_on #40790
Conversation
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.
nice!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis and @rafiss)
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.
This looks good, but unfortunately I'm fairly convinced (maybe 70% confident?) that this doesn't add much or any coverage to the vectorized engine. The reason is that all of the tests use constants only, but none of the vectorized engine's operators can operate on only constants - we just didn't make operators for those.
For example, if you had an eval test that said:
eval
2+2
----
4
This would attempt to make a query like select 2+2
, I think. Since the tests explicitly disable constant folding, this will make a renderNode with the scalar expression 2+2, which will then... hm, I guess I don't know what it would do. Maybe it would actually work in the end - would we plan two "Datum" operators and add them all?
@asubiotto could you please check to see if any vectorized plans actually get created from the eval tests?
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis)
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.
In #40674 I noticed that adding two constant integers ended up being done in a projPlusInt64ConstInt64Op
(there was one batch where every row just had a constant value), but I stopped working on that for now so I didn't figure out why.
Reviewable status: complete! 0 of 0 LGTMs obtained
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.
Oh cool! Well in that case I guess I have no objections here.
Reviewable status: complete! 0 of 0 LGTMs obtained
OK, I think I was a bit naive in assuming this would just work. I did a little more investigation to ensure this runs through the vectorized engine. The current integration test works by issuing the expression through I'll think of something and update the PR accordingly. |
Updated to explicitly create a |
Investigated the failing test but unsure how to fix this properly. The failing test is:
This is caused because we type check the expression (which returns cockroach/pkg/sql/execinfra/expr.go Line 75 in 4abcf22
But then returns the constant result ( -123 ) cast to a tree.TypedExpr :cockroach/pkg/sql/execinfra/expr.go Line 92 in 4abcf22
The vectorized flow creator then calls ResolvedType() on this expression, which returns an int64 :cockroach/pkg/sql/colexec/execplan.go Line 1041 in 4abcf22
The root cause seems to be that we don't retain proper type information in processExpression because of the call to WalkExpr with a TypedExpr then cast to a TypedExpr :cockroach/pkg/sql/execinfra/expr.go Lines 81 to 92 in 4abcf22
@solongordon, could you advise on the best way to fix this? |
Skipped that test as it is a limitation of our type system that the width gets lost when evaluating an expression. RFAL. |
Friendly ping |
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.
LGTM! This is pretty cool.
Release note: None Release justification: Category 1 non-production code change to increase test coverage of the vectorized execution engine.
TFTR bors r=jordanlewis,rafiss |
40790: sql/sem/tree: run TestEval with vectorize=experimental_on r=jordanlewis,rafiss a=asubiotto Release note: None Release justification: Category 1 non-production code change to increase test coverage of the vectorized execution engine. Close #40635 Co-authored-by: Alfonso Subiotto Marqués <alfonso@cockroachlabs.com>
Build succeeded |
Release note: None
Release justification: Category 1 non-production code change to increase
test coverage of the vectorized execution engine.
Close #40635