-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Conversation
e.outerExec = rightExec | ||
e.innerFilter = v.LeftConditions | ||
e.outerFilter = v.RightConditions | ||
e.innerKeys = leftHashKey | ||
e.outerKeys = rightHashKey | ||
if defaultValues == nil { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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 { |
There was a problem hiding this comment.
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.
plan/logical_plans.go
Outdated
// 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
executor/builder.go
Outdated
@@ -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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
innerExec is nil
/run-all-tests |
fix #5338 and fix #5278
PTAL @zz-jason @coocood @hanfei1991