Skip to content

support hash join in new plan#1234

Merged
hanfei19910905 merged 10 commits intomasterfrom
hanfei/rewrite_plan
May 19, 2016
Merged

support hash join in new plan#1234
hanfei19910905 merged 10 commits intomasterfrom
hanfei/rewrite_plan

Conversation

@hanfei19910905
Copy link

support hash join

@@ -0,0 +1,45 @@
// Copyright 2015 PingCAP, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

2015 -> 2016

@coocood
Copy link
Member

coocood commented May 16, 2016

You can add a function in plan like

func AddParentChildren(parent, children Plan) {
    parent.AddChildren(children)
    children.AddParent(parent)
}

So you will never forget to call one of them.

if sel.From != nil {
p = b.buildNewSinglePathPlan(sel.From.TableRefs)
if sel.Where != nil {
p = b.buildFilter(p, sel.Where)
Copy link
Member

Choose a reason for hiding this comment

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

If where is all pushed down, this would be redundant?

Copy link
Author

@hanfei19910905 hanfei19910905 May 16, 2016

Choose a reason for hiding this comment

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

we build filter first and then apply predicate pushing down. when finishing it, this filter can be removed.

}

func (ce *columnsExtractor) Leave(expr ast.Node) (ret ast.Node, ok bool) {
return expr, false
Copy link
Member

Choose a reason for hiding this comment

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

return expr, true

@shenli
Copy link
Member

shenli commented May 17, 2016

Add a simple benchmark for join like: https://github.com/pingcap/tidb/blob/master/bench_test.go#L160

case plan.LeftOuterJoin:
e.outter = true
e.leftSmall = false
big, small = 0, 1
Copy link
Member

Choose a reason for hiding this comment

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

What's this 0 and 1 mean? Please add comment or use const.

Copy link
Member

@shenli shenli May 18, 2016

Choose a reason for hiding this comment

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

e.leftSmall is enough for deciding which child will be used for smallExec. So big/small is redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution This PR is from a community contributor.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants