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 builtinJSONKeysSig #12700

Merged
merged 3 commits into from
Oct 16, 2019

Conversation

js00070
Copy link
Contributor

@js00070 js00070 commented Oct 14, 2019

What problem does this PR solve?

implement vectorized builtinJSONKeysSig mentioned here #12104

What is changed and how it works?

about 10% faster

BenchmarkVectorizedBuiltinJSONFunc/builtinJSONKeysSig-VecBuiltinFunc-4              4027            266976 ns/op           91728 B/op       4914 allocs/op
BenchmarkVectorizedBuiltinJSONFunc/builtinJSONKeysSig-NonVecBuiltinFunc-4           4203            290651 ns/op           91728 B/op       4914 allocs/op

Check List

Tests

  • Unit test

@js00070 js00070 requested a review from a team as a code owner October 14, 2019 16:48
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Oct 14, 2019
@ghost ghost requested review from qw4990 and XuHuaiyu and removed request for a team October 14, 2019 16:49
@codecov
Copy link

codecov bot commented Oct 14, 2019

Codecov Report

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

@@             Coverage Diff             @@
##             master     #12700   +/-   ##
===========================================
  Coverage   79.8672%   79.8672%           
===========================================
  Files           462        462           
  Lines        105723     105723           
===========================================
  Hits          84438      84438           
  Misses        15010      15010           
  Partials       6275       6275

Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

LGTM


j = buf.GetJSON(i)
if j.TypeCode != json.TypeCodeObject {
result.AppendNull()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we return a json.ErrInvalidJSONData error in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I should.
But I don't know whether or not it should return the error immediately in the for loop, or return the error at the end of the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also have the same confusion in other vectorized function

Copy link
Contributor

@Reminiscent Reminiscent Oct 16, 2019

Choose a reason for hiding this comment

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

Normally, if err != nil, we need to return error directly. But there are some cases where the error is reprocessed, it should recheck the err. For example, https://github.com/pingcap/tidb/blob/master/expression/builtin_arithmetic_vec.go#L88-L93

Copy link
Contributor

@Reminiscent Reminiscent left a comment

Choose a reason for hiding this comment

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

LGTM

@Reminiscent Reminiscent added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. labels Oct 16, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 16, 2019

Your auto merge job has been accepted, waiting for 12751

@sre-bot
Copy link
Contributor

sre-bot commented Oct 16, 2019

/run-all-tests

@sre-bot sre-bot merged commit 92265be into pingcap:master Oct 16, 2019
@js00070 js00070 deleted the vecJSONKeys branch November 7, 2019 11:07
XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 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. 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.

6 participants