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

support hash join in new plan #1234

Merged
merged 10 commits into from
May 19, 2016
Merged

support hash join in new plan #1234

merged 10 commits into from
May 19, 2016

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.

}
}
}
return inNode, 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 inNode, true

@coocood
Copy link
Member

coocood commented May 19, 2016

LGTM

@hanfei19910905
Copy link
Author

@shenli PATL

)

// Error codes.
const (
CodeUnsupportedType terror.ErrCode = 1
SystemInternalError terror.ErrCode = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

1 -> 2 ?

@hanfei19910905 hanfei19910905 force-pushed the hanfei/rewrite_plan branch 2 times, most recently from 496c6a1 to 9b5a3b1 Compare May 19, 2016 07:25
@shenli
Copy link
Member

shenli commented May 19, 2016

LGTM

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

@zimulala zimulala May 19, 2016

Choose a reason for hiding this comment

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

2016 -> 2015 ?

@hanfei19910905 hanfei19910905 merged commit 228f1d7 into master May 19, 2016
@hanfei19910905 hanfei19910905 deleted the hanfei/rewrite_plan branch May 19, 2016 07:43
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Dec 18, 2019
@ti-chi-bot ti-chi-bot bot mentioned this pull request May 15, 2023
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