-
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: implement vectorized evaluation for 'builtinLastDaySig' #13592
Conversation
Codecov Report
@@ Coverage Diff @@
## master #13592 +/- ##
================================================
+ Coverage 79.8789% 79.8803% +0.0014%
================================================
Files 472 472
Lines 115516 115534 +18
================================================
+ Hits 92273 92289 +16
- Misses 15981 15986 +5
+ Partials 7262 7259 -3 |
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.
Thanks for your contribution.
Please add some test cases to check correctness.
buf, err := b.bufAllocator.get(types.ETDatetime, n) | ||
if err != nil { | ||
return err | ||
} | ||
defer b.bufAllocator.put(buf) |
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 use result to get the son's result directly without alloc a buffer.
- We need to call b.arg[0].VecEvalTime to get son's result.
result.ResizeTime(n, false) | ||
times := result.Times() | ||
for i := 0; i < n; i++ { | ||
tm := ds[i].Time |
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 need check Null before calculate.
tm := ds[i].Time | ||
year, month, day := tm.Year(), tm.Month(), tm.Day() | ||
if month == 0 || day == 0 { | ||
return handleInvalidTimeError(b.ctx, types.ErrIncorrectDatetimeValue.GenWithStackByArgs(buf.GetString(i))) |
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 the error can be handled, we should set null and continue.
I'm sorry, but this function is vectorized by #13503 |
What problem does this PR solve?
expression: implement vectorized evaluation for 'builtinLastDaySig'
What is changed and how it works?
goos: windows
goarch: amd64
pkg: github.com/pingcap/tidb/expression
BenchmarkVectorizedBuiltinTimeFuncGenerated-2 1000000000 0.0610 ns/op 0 B/op 0 allocs/op
BenchmarkVectorizedBuiltinTimeFunc-2 1000000000 0.0350 ns/op 0 B/op 0 allocs/op
PASS
Check List
Tests