Skip to content

Commit

Permalink
executor: Fix push downed topN won't replace correlated column problem (
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored May 10, 2024
1 parent 7d1fc94 commit 389b0c1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3041,13 +3041,18 @@ func constructDAGReq(ctx sessionctx.Context, plans []plannercore.PhysicalPlan, s

func (b *executorBuilder) corColInDistPlan(plans []plannercore.PhysicalPlan) bool {
for _, p := range plans {
x, ok := p.(*plannercore.PhysicalSelection)
if !ok {
continue
}
for _, cond := range x.Conditions {
if len(expression.ExtractCorColumns(cond)) > 0 {
return true
switch x := p.(type) {
case *plannercore.PhysicalSelection:
for _, cond := range x.Conditions {
if len(expression.ExtractCorColumns(cond)) > 0 {
return true
}
}
case *plannercore.PhysicalTopN:
for _, byItem := range x.ByItems {
if len(expression.ExtractCorColumns(byItem.Expr)) > 0 {
return true
}
}
}
}
Expand Down

0 comments on commit 389b0c1

Please sign in to comment.