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 index_lookup_merge_join in physical plan. #11338

Merged

Conversation

lzmhhh123
Copy link
Contributor

@lzmhhh123 lzmhhh123 commented Jul 19, 2019

What problem does this PR solve?

A split pull request for #9571 .

What is changed and how it works?

Move the index_merge_join in planner.

Check List

Tests

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

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity

Related changes

  • None

@lzmhhh123 lzmhhh123 added type/enhancement The issue or PR belongs to an enhancement. sig/planner SIG: Planner type/new-feature labels Jul 19, 2019
@codecov
Copy link

codecov bot commented Jul 19, 2019

Codecov Report

Merging #11338 into master will decrease coverage by 0.2554%.
The diff coverage is 100%.

@@               Coverage Diff                @@
##             master     #11338        +/-   ##
================================================
- Coverage   81.5939%   81.3384%   -0.2555%     
================================================
  Files           445        445                
  Lines         96566      95571       -995     
================================================
- Hits          78792      77736      -1056     
- Misses        12241      12302        +61     
  Partials       5533       5533

@qw4990 qw4990 self-requested a review July 24, 2019 08:26
@lzmhhh123 lzmhhh123 requested review from winoros and zz-jason August 1, 2019 02:54
@lzmhhh123 lzmhhh123 force-pushed the dev/support_index_merge_join_in_physical_plan branch from e6cf850 to 38a0de2 Compare August 1, 2019 05:00
@lzmhhh123 lzmhhh123 force-pushed the dev/support_index_merge_join_in_physical_plan branch from e64ebc4 to 05b6b5b Compare August 1, 2019 07:21
@zz-jason zz-jason requested review from zz-jason and qw4990 August 5, 2019 08:53
@zz-jason zz-jason removed their request for review August 8, 2019 06:19
Copy link
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

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

LGTM

lzmhhh123 and others added 3 commits August 23, 2019 17:42
Co-Authored-By: Kenan Yao <cauchy1992@gmail.com>
Co-Authored-By: Kenan Yao <cauchy1992@gmail.com>
Co-Authored-By: Kenan Yao <cauchy1992@gmail.com>
@lzmhhh123 lzmhhh123 added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 23, 2019
└─IndexReader_91 9.99 root index:Selection_90
└─Selection_90 9.99 cop not(isnull(test.p.relate_id))
└─IndexScan_89 10.00 cop table:p, index:relate_id, range: decided by [eq(test.p.relate_id, test.tr.id)], keep order:false, stats:pseudo
└─TopN_16 0.00 root test.te.expect_time:asc, offset:0, count:5
Copy link
Member

Choose a reason for hiding this comment

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

It's wried, it should be a Limit operator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the result of rule_topn_push_down.

@sre-bot
Copy link
Contributor

sre-bot commented Aug 28, 2019

@zz-jason, @qw4990, @lamxTyler, @eurekaka, @winoros, PTAL.

1 similar comment
@sre-bot
Copy link
Contributor

sre-bot commented Aug 30, 2019

@zz-jason, @qw4990, @lamxTyler, @eurekaka, @winoros, PTAL.

@lzmhhh123 lzmhhh123 requested a review from zz-jason August 30, 2019 08:24
@sre-bot
Copy link
Contributor

sre-bot commented Sep 2, 2019

@zz-jason, @qw4990, @lamxTyler, @eurekaka, @winoros, PTAL.

@qw4990 qw4990 removed their request for review September 2, 2019 08:37
@@ -404,6 +406,15 @@ func (p PhysicalIndexJoin) Init(ctx sessionctx.Context, stats *property.StatsInf
return &p
}

// Init initializes PhysicalIndexMergeJoin.
func (p PhysicalIndexMergeJoin) Init(ctx sessionctx.Context) *PhysicalIndexMergeJoin {
ctx.GetSessionVars().PlanID++
Copy link
Member

Choose a reason for hiding this comment

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

We can call p.PhysicalIndexJoin.Init(ctx), then reset p.tp.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PhysicalIndexJoin.Init(ctx) news a new basePlan. I think that's unnecessary.

@@ -1360,20 +1360,20 @@ func (s *testPlanSuite) TestIndexJoinUnionScan(c *C) {
}{
// Test Index Join + UnionScan + TableScan.
{
sql: "select /*+ TIDB_INLJ(t2) */ * from t t1, t t2 where t1.a = t2.a",
best: "IndexJoin{TableReader(Table(t))->UnionScan([])->TableReader(Table(t))->UnionScan([])}(test.t1.a,test.t2.a)",
sql: "select /*+ TIDB_INLJ(t1, t2) */ * from t t1, t t2 where t1.a = t2.a",
Copy link
Member

Choose a reason for hiding this comment

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

why changing the hint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Recovered.

@XuHuaiyu XuHuaiyu mentioned this pull request Sep 3, 2019
@lzmhhh123 lzmhhh123 requested a review from alivxxx September 4, 2019 03:24
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. status/can-merge Indicates a PR has been approved by a committer. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Sep 4, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Sep 4, 2019

/run-all-tests

@sre-bot sre-bot merged commit 8450613 into pingcap:master Sep 4, 2019
@lzmhhh123 lzmhhh123 deleted the dev/support_index_merge_join_in_physical_plan branch September 4, 2019 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement. type/new-feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants