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

planner: support PointGet plan when table has alias name #11270

Merged
merged 2 commits into from Aug 7, 2019

Conversation

@sduzh
Copy link
Contributor

commented Jul 16, 2019

What problem does this PR solve?

fix #11149

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Side effects

  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to update the tidb-ansible repository
  • Need to be included in the release note

manual tests

mysql> create table t (a int not null, b int not null, c char(50) not null, primary key(a, b));
Query OK, 0 rows affected (0.01 sec)
mysql> explain select * from t where a = 1 and b = 1;
+-------------+-------+------+--------------------+
| id | count | task | operator info |
+-------------+-------+------+--------------------+
| Point_Get_1 | 1.00 | root | table:t, index:a b |
+-------------+-------+------+--------------------+
1 row in set (0.00 sec)
mysql> explain select * from t tmp where a = 1 and b = 1;
+-------------+-------+------+--------------------+
| id | count | task | operator info |
+-------------+-------+------+--------------------+
| Point_Get_1 | 1.00 | root | table:t, index:a b |
+-------------+-------+------+--------------------+
1 row in set (0.00 sec)
mysql> select tmp.a, tmp.b, tmp.c from t tmp where t.a = 1 and t.b = 1;
ERROR 1054 (42S22): Unknown column 't.a' in 'where clause'
mysql> select tmp.a, tmp.b, tmp.c from t tmp where tmp.a = 1 and tmp.b = 1;
Empty set (0.01 sec)

@codecov

This comment has been minimized.

Copy link

commented Jul 16, 2019

Codecov Report

Merging #11270 into master will decrease coverage by 0.1285%.
The diff coverage is n/a.

@@               Coverage Diff                @@
##             master     #11270        +/-   ##
================================================
- Coverage   81.7927%   81.6642%   -0.1286%     
================================================
  Files           426        426                
  Lines         94380      93473       -907     
================================================
- Hits          77196      76334       -862     
- Misses        11785      11786         +1     
+ Partials       5399       5353        -46

@shenli shenli added the contribution label Jul 16, 2019

@sduzh sduzh force-pushed the sduzh:feature-point-get branch 2 times, most recently from d35e187 to 61d3315 Jul 16, 2019

@XuHuaiyu XuHuaiyu changed the title palnner: support PointGet plan when table has alias name (#11149) planner: support PointGet plan when table has alias name Jul 17, 2019

planner/core/point_get_plan.go Show resolved Hide resolved
executor/point_get_test.go Show resolved Hide resolved
executor/point_get_test.go Outdated Show resolved Hide resolved
executor/point_get_test.go Outdated Show resolved Hide resolved

@sduzh sduzh force-pushed the sduzh:feature-point-get branch from 61d3315 to dc3dadc Jul 17, 2019

@winoros

This comment has been minimized.

Copy link
Member

commented Jul 17, 2019

@sduzh It should be planner instead of palnner.

planner/core/point_get_plan.go Outdated Show resolved Hide resolved
planner/core/point_get_plan.go Outdated Show resolved Hide resolved

@sduzh sduzh force-pushed the sduzh:feature-point-get branch from dc3dadc to d3ab713 Jul 17, 2019

@sduzh sduzh force-pushed the sduzh:feature-point-get branch from d3ab713 to 1c8c75a Jul 18, 2019

@sduzh sduzh force-pushed the sduzh:feature-point-get branch 2 times, most recently from 9515d1b to 0a339e7 Jul 18, 2019

@zz-jason
Copy link
Member

left a comment

LGTM

@sre-bot

This comment has been minimized.

Copy link

commented Aug 3, 2019

Hi contributor, thanks for your PR.

This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically.

@@ -334,36 +340,40 @@ func buildSchemaFromFields(ctx sessionctx.Context, dbName model.CIStr, tbl *mode
return schema
}

func getSingleTableName(tableRefs *ast.TableRefsClause) *ast.TableName {
// return the ast node of queried table name and the alias string.

This comment has been minimized.

Copy link
@eurekaka

eurekaka Aug 6, 2019

Contributor

Please follow the comment convention, for example: comment starting with function name / variable name; capitalize first character of beginning word and add . in the end of sentences.

This comment has been minimized.

Copy link
@sduzh

sduzh Aug 6, 2019

Author Contributor

done

@sduzh sduzh force-pushed the sduzh:feature-point-get branch from 74a5cb5 to b89dda6 Aug 6, 2019

@eurekaka
Copy link
Contributor

left a comment

LGTM

@eurekaka

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2019

/run-all-tests

@zz-jason zz-jason removed the status/LGT1 label Aug 7, 2019

@sre-bot

This comment has been minimized.

Copy link

commented Aug 7, 2019

/run-all-tests

@sre-bot sre-bot merged commit 700bf2f into pingcap:master Aug 7, 2019

14 checks passed

ci/circleci Your tests passed on CircleCI!
Details
idc-jenkins-ci-tidb/build Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/build_check_race Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/check_dev Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/check_dev_2 Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/common-test job succeeded
Details
idc-jenkins-ci-tidb/integration-common-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/integration-compatibility-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/integration-ddl-test Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/mybatis-test job succeeded
Details
idc-jenkins-ci-tidb/sqllogic-test-1 Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/sqllogic-test-2 Jenkins job succeeded.
Details
idc-jenkins-ci-tidb/unit-test Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.