-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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: new plan supports join. #3126
Conversation
case RightOuterJoin: | ||
hashJoin.SmallTable = 0 | ||
case InnerJoin: | ||
// We will use right table as small table. |
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.
What does this comment mean?
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.
If right plan's count is smaller than the left one, we will treat right plan as small table.
plan/task_profile.go
Outdated
@@ -27,6 +27,7 @@ type taskProfile interface { | |||
cost() float64 | |||
copy() taskProfile | |||
plan() PhysicalPlan | |||
finishTask(ctx context.Context, allocator *idAllocator) taskProfile |
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.
The finishTask
only make sense in copTaskProfile
, promote it to taskProfile
is confusing.
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.
finishCopTask
makes more sense.
And add comment on it.
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.
Move it to a plain function is better, it makes the interface clean.
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.
fixed, PTAL
LGTM |
if cop, ok := profile.(*copTaskProfile); ok { | ||
profile = cop.finishTask(p.ctx, p.allocator) | ||
} | ||
profile = finishCopTask(profile, p.ctx, p.allocator) |
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 not check task type here?
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.
task checking is moved to finishCopTask
@@ -378,7 +401,7 @@ func (p *PhysicalAggregation) attach2TaskProfile(profiles ...taskProfile) taskPr | |||
cop.cnt = cop.cnt * aggFactor | |||
} | |||
} | |||
profile = cop.finishTask(p.ctx, p.allocator) | |||
profile = finishCopTask(cop, p.ctx, p.allocator) |
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.
Need cop.copy()?
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.
needn't, finishCopTask will not change cop task.
LGTM |
This PR let new plan support join. We only introduce hash join now, and in order to simplify problem, hash join will block any physical property.
@shenli @coocood @winoros @lamxTyler PTAL