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: vectorized builtinDateFormatSig #14934

Merged
merged 15 commits into from
Mar 11, 2020
Merged

Conversation

lance6716
Copy link
Contributor

@lance6716 lance6716 commented Feb 25, 2020

PCP #12106

What problem does this PR solve?

Implement builtinDateFormatSig vectorized function

What is changed and how it works?

  • Implement builtinDateFormatSig vectorized function
  • Add 1 benchmark case

Check List

Tests

  • Unit test
lance in ~/Projects/go/src/github.com/pingcap/tidb/expression on pcp12160-fin λ
go test -v -benchmem -bench=BenchmarkVectorizedBuiltinTimeFunc -run=BenchmarkVectorizedBuiltinTimeFunc -args builtinDateFormatSig
goos: darwin
goarch: amd64
pkg: github.com/pingcap/tidb/expression
BenchmarkVectorizedBuiltinTimeFuncGenerated-4   	1000000000	         0.233 ns/op	       0 B/op	       0 allocs/op
BenchmarkVectorizedBuiltinTimeFunc/builtinDateFormatSig-VecBuiltinFunc-4         	    1924	    611633 ns/op	  211916 B/op	    9395 allocs/op
BenchmarkVectorizedBuiltinTimeFunc/builtinDateFormatSig-NonVecBuiltinFunc-4      	    1534	    699347 ns/op	  212261 B/op	    9395 allocs/op
PASS
ok  	github.com/pingcap/tidb/expression	5.825s

@lance6716 lance6716 requested a review from a team as a code owner February 25, 2020 08:53
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Feb 25, 2020
@codecov
Copy link

codecov bot commented Feb 25, 2020

Codecov Report

Merging #14934 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #14934   +/-   ##
===========================================
  Coverage   80.4123%   80.4123%           
===========================================
  Files           503        503           
  Lines        133232     133232           
===========================================
  Hits         107135     107135           
  Misses        17690      17690           
  Partials       8407       8407

@qw4990 qw4990 self-requested a review February 25, 2020 08:59
@qw4990
Copy link
Contributor

qw4990 commented Feb 25, 2020

Thanks for your contribution @lance6716, could you please post the benchmark result into your PR's description?

@lance6716
Copy link
Contributor Author

Thanks for your contribution @lance6716, could you please post the benchmark result into your PR's description?

done

@zz-jason zz-jason removed the request for review from a team March 3, 2020 08:15
@qw4990
Copy link
Contributor

qw4990 commented Mar 10, 2020

Sorry for my late reply, it's almost LGTM, please address the comment. @lance6716

@qw4990 qw4990 requested a review from wshwsh12 March 10, 2020 07:59
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.

Rest LGTM

expression/builtin_time_vec.go Outdated Show resolved Hide resolved
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.

LGTM

@wshwsh12 wshwsh12 requested a review from qw4990 March 10, 2020 08:13
@wshwsh12 wshwsh12 added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 10, 2020
qw4990
qw4990 previously approved these changes Mar 10, 2020
Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

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

LGTM

@qw4990 qw4990 added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 10, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Mar 10, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Mar 10, 2020

@lance6716 merge failed.

@qw4990
Copy link
Contributor

qw4990 commented Mar 10, 2020

/run-integration-copr-test

@lance6716
Copy link
Contributor Author

/run-integration-copr-test

I couldn't understand the error log, please help me to clarify 😭

@qw4990
Copy link
Contributor

qw4990 commented Mar 10, 2020

/run-integration-copr-test

I couldn't understand the error log, please help me to clarify 😭

Don't worry, I'm investigating this problem now, it seems there are some bad cases...

@qw4990
Copy link
Contributor

qw4990 commented Mar 11, 2020

@lance6716 Friendly ping, #15263 has been merged, so please update your PR.

@lance6716
Copy link
Contributor Author

/run-all-tests

1 similar comment
@qw4990
Copy link
Contributor

qw4990 commented Mar 11, 2020

/run-all-tests

Comment on lines 1785 to 1789
result.AppendNull()

if isOriginalIntOrDecimalZero && !isOriginalStringZero {
continue
}
Copy link
Contributor

Choose a reason for hiding this comment

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

result.AppendNull() should be in this branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

vector based DATE_FORMAT will exit when encountered first handleInvalidTimeError, is this the same behaviour with row based DATE_FORMAT?

@lance6716
Copy link
Contributor Author

/run-all-tests

@lance6716
Copy link
Contributor Author

/run-integration-copr-test

@lance6716
Copy link
Contributor Author

seems I can't use ⬇️
/run-integration-copr-test

@lance6716
Copy link
Contributor Author

/run-all-tests

@lance6716
Copy link
Contributor Author

I guess I forgot a continue in t.InvalidZero() branch, so redundant result may appear. Please help check /run-integration-copr-test when it is convenient for you @qw4990 😄

@qw4990
Copy link
Contributor

qw4990 commented Mar 11, 2020

/run-all-tests

@qw4990
Copy link
Contributor

qw4990 commented Mar 11, 2020

/run-all-tests

@qw4990 qw4990 merged commit 1cb7739 into pingcap:master Mar 11, 2020
@lance6716 lance6716 deleted the pcp12160-fin branch March 11, 2020 07:23
@qw4990
Copy link
Contributor

qw4990 commented Mar 11, 2020

Merged, thanks you @lance6716 :D
And there is another function builtinFormatWithLocaleSig which is not vectorized, could you help us to vectorize it?

@lance6716
Copy link
Contributor Author

Merged, thanks you @lance6716 :D
And there is another function builtinFormatWithLocaleSig which is not vectorized, could you help us to vectorize it?

Yes, in fact that's #14934

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. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants