-
Notifications
You must be signed in to change notification settings - Fork 5.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
expression: support vectorized execution of expressions #5184
Conversation
expression/chunk_executor.go
Outdated
func evalOneColumn(sc *stmtctx.StatementContext, expr Expression, input, output *chunk.Chunk, colID int) error { | ||
switch fieldType, evalType := expr.GetType(), expr.GetType().EvalType(); evalType { | ||
case types.ETInt: | ||
for rowID, length := 0, input.NumRows(); rowID < length; rowID++ { |
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.
We can switch to assign a function to avoid loop in each case.
var execFunc func
switch {
case types.ETInt:
execFunc = executeToInt
}
for rowID, length := 0, input.NumRows(); rowID < length; rowID++ {
execFunc()
}
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 it is already simple enough and there is no need to bring the latency of function addressing.
any benchmarks? |
expression/chunk_executor.go
Outdated
@@ -0,0 +1,278 @@ | |||
// Copyright 2016 PingCAP, Inc. |
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.
2016 -> 2017
LGTM |
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
expression/chunk_executor.go
Outdated
func evalOneColumn(sc *stmtctx.StatementContext, expr Expression, input, output *chunk.Chunk, colID int) error { | ||
switch fieldType, evalType := expr.GetType(), expr.GetType().EvalType(); evalType { | ||
case types.ETInt: | ||
for rowID, length := 0, input.NumRows(); rowID < length; rowID++ { |
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.
s/ rowID < length/ err != nil && rowID < length
and extract the err check code
expression/chunk_executor.go
Outdated
switch fieldType, evalType := expr.GetType(), expr.GetType().EvalType(); evalType { | ||
case types.ETInt: | ||
err := executeToInt(sc, expr, fieldType, input, output, rowID, colID) | ||
if err != nil { |
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.
extract the error check code
/run-all-tests |
No description provided.