Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

myz000
Copy link

@myz000 myz000 commented Nov 19, 2019

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

  • Unit test

@myz000 myz000 requested a review from a team as a code owner November 19, 2019 11:31
@ghost ghost requested review from qw4990 and wshwsh12 November 19, 2019 11:31
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Nov 19, 2019
@ghost ghost removed their request for review November 19, 2019 11:31
@CLAassistant
Copy link

CLAassistant commented Nov 19, 2019

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Nov 19, 2019

Codecov Report

Merging #13592 into master will increase coverage by 0.0014%.
The diff coverage is 0%.

@@               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

Copy link
Contributor

@wshwsh12 wshwsh12 left a 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.

Comment on lines +724 to +728
buf, err := b.bufAllocator.get(types.ETDatetime, n)
if err != nil {
return err
}
defer b.bufAllocator.put(buf)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. We can use result to get the son's result directly without alloc a buffer.
  2. 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
Copy link
Contributor

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)))
Copy link
Contributor

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.

@ekalinin
Copy link
Contributor

I'm sorry, but this function is vectorized by #13503

@myz000 myz000 closed this Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression contribution This PR is from a community contributor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants