Skip to content

Commit

Permalink
refine boolean logic
Browse files Browse the repository at this point in the history
  • Loading branch information
tisonkun committed Mar 10, 2021
1 parent e8e85c2 commit 8a4c0e1
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions planner/core/exhaust_physical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -2324,17 +2324,13 @@ func (la *LogicalAggregation) getHashAggs(prop *property.PhysicalProperty) []Phy
if la.ctx.GetSessionVars().AllowBCJ {
taskTypes = append(taskTypes, property.CopTiFlashLocalReadTaskType)
}
if la.ctx.GetSessionVars().AllowMPPExecution && la.checkCanPushDownToMPP() {
canPushDownToMPP := la.ctx.GetSessionVars().AllowMPPExecution && la.checkCanPushDownToMPP()
if canPushDownToMPP {
taskTypes = append(taskTypes, property.MppTaskType)
}
if la.HasDistinct() {
// TODO: remove AllowDistinctAggPushDown after the cost estimation of distinct pushdown is implemented.
// If AllowDistinctAggPushDown is set to true, we should not consider RootTask.
considerRootTask := !la.ctx.GetSessionVars().AllowDistinctAggPushDown
// If aggregation can be pushed down to MPP, we should not consider RootTask.
considerRootTask = considerRootTask && !(la.ctx.GetSessionVars().AllowMPPExecution && la.checkCanPushDownToMPP())

if considerRootTask {
// TODO: remove after the cost estimation of distinct pushdown is implemented.
if !la.ctx.GetSessionVars().AllowDistinctAggPushDown && !canPushDownToMPP {
taskTypes = []property.TaskType{property.RootTaskType}
}
} else if !la.aggHints.preferAggToCop {
Expand Down

0 comments on commit 8a4c0e1

Please sign in to comment.