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

*: add a blacklist to disallow pushing down specific expressions #10688

Merged
merged 10 commits into from
Jun 12, 2019

Conversation

XuHuaiyu
Copy link
Contributor

@XuHuaiyu XuHuaiyu commented Jun 4, 2019

What problem does this PR solve?

This commit adds a switch to support manually control wether to push down expressions.

What is changed and how it works?

  1. Add a system table mysql.expr_pushdown_blacklist
tidb> show create table mysql.expr_pushdown_blacklist;
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------+
| Table                   | Create Table                                                                                                                     |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------+
| expr_pushdown_blacklist | CREATE TABLE `expr_pushdown_blacklist` (
  `name` char(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
tidb> create table t(a int);
Query OK, 0 rows affected (0.00 sec)

tidb> desc select * from t where a < 1;
+---------------------+----------+------+------------------------------------------------------------+
| id                  | count    | task | operator info                                              |
+---------------------+----------+------+------------------------------------------------------------+
| TableReader_7       | 3323.33  | root | data:Selection_6                                           |
| └─Selection_6       | 3323.33  | cop  | lt(test.t.a, 1)                                            |
|   └─TableScan_5     | 10000.00 | cop  | table:t, range:[-inf,+inf], keep order:false, stats:pseudo |
+---------------------+----------+------+------------------------------------------------------------+
3 rows in set (0.00 sec)

tidb> insert into mysql.expr_pushdown_blacklist values("lt");
Query OK, 1 row affected (0.00 sec)

tidb> desc select * from t where a < 1;
+---------------------+----------+------+------------------------------------------------------------+
| id                  | count    | task | operator info                                              |
+---------------------+----------+------+------------------------------------------------------------+
| TableReader_7       | 3323.33  | root | data:Selection_6                                           |
| └─Selection_6       | 3323.33  | cop  | lt(test.t.a, 1)                                            |
|   └─TableScan_5     | 10000.00 | cop  | table:t, range:[-inf,+inf], keep order:false, stats:pseudo |
+---------------------+----------+------+------------------------------------------------------------+
3 rows in set (0.00 sec)

tidb> admin reload expr_pushdown_blacklist;                                         Query OK, 0 rows affected (0.00 sec)

tidb> desc select * from t where a < 1;
+---------------------+----------+------+------------------------------------------------------------+
| id                  | count    | task | operator info                                              |
+---------------------+----------+------+------------------------------------------------------------+
| Selection_5         | 8000.00  | root | lt(test.t.a, 1)                                            |
| └─TableReader_7     | 10000.00 | root | data:TableScan_6                                           |
|   └─TableScan_6     | 10000.00 | cop  | table:t, range:[-inf,+inf], keep order:false, stats:pseudo |
+---------------------+----------+------+------------------------------------------------------------+
3 rows in set (0.00 sec)

Check List

Tests

  • Integration test
  • Manual test
    As the above mentioned.

Code changes

  • Has exported function/method change
  • Has exported variable/fields change

Side effects

N/A

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

@XuHuaiyu XuHuaiyu requested review from lonng and zz-jason June 4, 2019 03:00
@XuHuaiyu XuHuaiyu changed the title *: add a switch to support manually control wether to push down expressions *: add a switch to support manually control whether to push down expressions Jun 5, 2019
@codecov
Copy link

codecov bot commented Jun 5, 2019

Codecov Report

Merging #10688 into master will decrease coverage by 0.1443%.
The diff coverage is 87.5%.

@@               Coverage Diff                @@
##             master     #10688        +/-   ##
================================================
- Coverage   80.3172%   80.1728%   -0.1444%     
================================================
  Files           415        416         +1     
  Lines         88260      88389       +129     
================================================
- Hits          70888      70864        -24     
- Misses        12181      12285       +104     
- Partials       5191       5240        +49

@qw4990 qw4990 self-requested a review June 5, 2019 06:58
@XuHuaiyu XuHuaiyu changed the title *: add a switch to support manually control whether to push down expressions *: add a blacklist to disallow pushing down specific expressions Jun 11, 2019
@XuHuaiyu
Copy link
Contributor Author

related PR: pingcap/parser#350

@@ -1412,6 +1413,21 @@ func loadSystemTZ(se *session) (string, error) {
return req.GetRow(0).GetString(0), nil
}

func loadExprPushdownBlacklist(se *session) (err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we merge this function with Next()? Seems that they are the same.

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

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

LGTM

@alivxxx alivxxx added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 12, 2019
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
Copy link
Contributor

qw4990 commented Jun 12, 2019

/run-all-tests

@qw4990 qw4990 added status/LGT2 Indicates that a PR has LGTM 2. status/all tests passed and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants