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

plan, executor: only set DefaultValues in agg push down. #5383

Merged
merged 4 commits into from
Dec 12, 2017

Conversation

winoros
Copy link
Member

@winoros winoros commented Dec 12, 2017

e.outerExec = rightExec
e.innerFilter = v.LeftConditions
e.outerFilter = v.RightConditions
e.innerKeys = leftHashKey
e.outerKeys = rightHashKey
if defaultValues == nil {
Copy link
Member

Choose a reason for hiding this comment

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

Can we combine this code block with the code block in line 603~607?

@@ -158,9 +157,6 @@ func (pe *projectionEliminater) eliminate(p LogicalPlan, replace map[string]*exp
if !(isProj && canEliminate && canProjectionBeEliminatedLoose(proj)) {
return p
}
if join, ok := p.Parents()[0].(*LogicalJoin); ok {
Copy link
Member

Choose a reason for hiding this comment

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

Why we could remove this?

Copy link
Member

Choose a reason for hiding this comment

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

@shenli projection elimination is done before aggregation push down, we can remove it safely.

@coocood
Copy link
Member

coocood commented Dec 12, 2017

LGTM

@@ -158,9 +157,6 @@ func (pe *projectionEliminater) eliminate(p LogicalPlan, replace map[string]*exp
if !(isProj && canEliminate && canProjectionBeEliminatedLoose(proj)) {
return p
}
if join, ok := p.Parents()[0].(*LogicalJoin); ok {
Copy link
Member

Choose a reason for hiding this comment

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

@shenli projection elimination is done before aggregation push down, we can remove it safely.

// instead of null padding.
// DefaultValues is only used for outer join, which is values the inner table's should be when the outer table
// doesn't match any inner table'row.
// That it's nil just means the default values is a slice of NULL.
Copy link
Member

Choose a reason for hiding this comment

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

how about:

// DefaultValues are only used for "LeftOuterJoin" and "RightOuterJoin" as the inner row when there is no inner row in the inner table can be joined with an outer row.
// NOTE: It is only set during the optimization of "aggregate push down", otherwise it will be nil, witch means a slice of NULLs.

zz-jason
zz-jason previously approved these changes Dec 12, 2017
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -581,30 +581,24 @@ func (b *executorBuilder) buildHashJoin(v *plan.PhysicalHashJoin) Executor {
}

defaultValues := v.DefaultValues
if defaultValues == nil {
defaultValues = make([]types.Datum, e.innerExec.Schema().Len())
Copy link
Member

Choose a reason for hiding this comment

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

innerExec is nil

@zz-jason
Copy link
Member

/run-all-tests

@coocood coocood merged commit 581002b into pingcap:master Dec 12, 2017
@winoros winoros deleted the default-values branch December 25, 2017 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TPCH q20 fails on master branch Lost connection to MySQL server during query
4 participants