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: remove correlated column sort items (#9435) #9440

Conversation

zz-jason
Copy link
Member

cherry pick #9435 to release 2.1

@zz-jason zz-jason added type/bugfix This PR fixes a bug. sig/planner SIG: Planner type/2.1 cherry-pick labels Feb 25, 2019
@zz-jason
Copy link
Member Author

/run-all-tests tikv=release-2.1 pd=release-2.1 tidb-test=release-2.1

@XuHuaiyu
Copy link
Contributor

2019/02/25 14:55:34.434 main.go:688: [fatal] run test [topn_push_down] err: sql:desc select * from t1 where t1.a in (select t2.a as a from t2 where t2.b > t1.b order by t1.b limit 1);: run "desc select * from t1 where t1.a in (select t2.a as a from t2 where t2.b > t1.b order by t1.b limit 1);" at line 183 err, we need:

desc select * from t1 where t1.a in (select t2.a as a from t2 where t2.b > t1.b order by t1.b limit 1);

id	count	task	operator info

Apply_15	9990.00	root	semi join, inner:Selection_19, equal:[eq(test.t1.a, test.t2.a)]

├─TableReader_18	9990.00	root	data:Selection_17

│ └─Selection_17	9990.00	cop	not(isnull(test.t1.a))

│   └─TableScan_16	10000.00	cop	table:t1, range:[-inf,+inf], keep order:false, stats:pseudo

└─Selection_19	0.80	root	not(isnull(test.t2.a))

  └─Limit_20	1.00	root	offset:0, count:1

    └─TableReader_26	1.00	root	data:Limit_25

      └─Limit_25	1.00	cop	offset:0, count:1

        └─Selection_24	1.00	cop

but got:

desc select * from t1 where t1.a in (select t2.a as a from t2 where t2.b > t1.b order by t1.b limit 1);

id	count	task	operator info

Apply_14	10000.00	root	semi join, inner:Limit_17, equal:[eq(test.t1.a, test.t2.a)]

├─TableReader_16	10000.00	root	data:TableScan_15

│ └─TableScan_15	10000.00	cop	table:t1, range:[-inf,+inf], keep order:false, stats:pseudo

└─Limit_17	1.00	root	offset:0, count:1

  └─TableReader_23	1.00	root	data:Limit_22

    └─Limit_22	1.00	cop	offset:0, count:1

      └─Selection_21	1.00	cop	gt(test.t2.b, test.t1.b)

        └─TableScan_20	1.25	cop	table:t2, range:[-inf,+inf], keep order:false, stats:pseudo

@zz-jason
Copy link
Member Author

/run-all-tests tikv=release-2.1 pd=release-2.1 tidb-test=release-2.1

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

@zz-jason zz-jason requested review from XuHuaiyu and eurekaka and removed request for XuHuaiyu February 25, 2019 08:06
@zz-jason zz-jason added status/LGT1 Indicates that a PR has LGTM 1. status/all tests passed labels Feb 25, 2019
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 status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 25, 2019
@zz-jason zz-jason merged commit db48da2 into pingcap:release-2.1 Feb 25, 2019
@zz-jason zz-jason deleted the cherrypick/2.1-order-by-correlated-column branch February 25, 2019 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants