-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: label more expressions as thread-safe and add more test cases #57171
Conversation
Hi @qw4990. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
for k := 0; k < 100; k++ { | ||
vs := []string{"1", "2"} | ||
if rand.Intn(2) < 1 { // is true | ||
tk.MustExec("prepare st from 'select a from t where (a-?) is true'") |
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 you can use expression.ParseSimpleExpr
and use expr.Eval
to do evaluation. It is more lightweight to save some performance.
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.
Yeah, but it seems it's unnecessary to save the performance here, and using SQL makes this test case more clear and easy-to-maintain.
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.
Just got your point. I'll use your suggestion to implement a lightweight test framework in my next PR and use it to test all builtin funcs.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #57171 +/- ##
=================================================
- Coverage 73.0078% 56.3249% -16.6830%
=================================================
Files 1657 1783 +126
Lines 457652 637590 +179938
=================================================
+ Hits 334122 359122 +25000
- Misses 103015 254298 +151283
- Partials 20515 24170 +3655
Flags with carried forward coverage won't be shown. Click here to find out more.
|
store := testkit.CreateMockStore(t) | ||
tk := testkit.NewTestKit(t, store) | ||
tk.MustExec("use test") | ||
tk.MustExec(`set global tidb_enable_instance_plan_cache=1`) |
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.
Do we need to reset this var in defer
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.
Good suggestion but this seems unnecessary since we're using Bazel and it runs each package seperately, and all test cases in this package "instanceplancache" would set "tidb_enable_instance_plan_cache=1".
[LGTM Timeline notifier]Timeline:
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lcwangchao, time-and-fate, XuHuaiyu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test check-dev2 |
@qw4990: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
What problem does this PR solve?
Issue Number: ref #54057
Problem Summary: expression: label more expressions as thread-safe and add more test cases
What changed and how does it work?
expression: label more expressions as thread-safe and add more test cases
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.