Skip to content

Commit

Permalink
planner: add sub plan info of shuffleReceiver when query explain anal…
Browse files Browse the repository at this point in the history
…yze (#27992)
  • Loading branch information
mmyj authored Nov 23, 2021
1 parent bba5fee commit 7fdafb4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -4260,7 +4260,8 @@ func (b *executorBuilder) buildShuffle(v *plannercore.PhysicalShuffle) *ShuffleE

for j, dataSource := range v.DataSources {
stub := plannercore.PhysicalShuffleReceiverStub{
Receiver: (unsafe.Pointer)(receivers[j]),
Receiver: (unsafe.Pointer)(receivers[j]),
DataSource: dataSource,
}.Init(b.ctx, dataSource.Stats(), dataSource.SelectBlockOffset(), nil)
stub.SetSchema(dataSource.Schema())
v.Tails[j].SetChildren(stub)
Expand Down
2 changes: 2 additions & 0 deletions planner/core/common_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,8 @@ func (e *Explain) explainPlanInRowFormat(p Plan, taskType, driverSide, indent st
}
case *PhysicalCTE:
e.ctes = append(e.ctes, x)
case *PhysicalShuffleReceiverStub:
err = e.explainPlanInRowFormat(x.DataSource, "root", "", childIndent, true)
}
return
}
Expand Down
4 changes: 3 additions & 1 deletion planner/core/physical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -1325,8 +1325,10 @@ const (
type PhysicalShuffleReceiverStub struct {
physicalSchemaProducer

// Worker points to `executor.shuffleReceiver`.
// Receiver points to `executor.shuffleReceiver`.
Receiver unsafe.Pointer
// DataSource is the PhysicalPlan of the Receiver.
DataSource PhysicalPlan
}

// CollectPlanStatsVersion uses to collect the statistics version of the plan.
Expand Down

0 comments on commit 7fdafb4

Please sign in to comment.