Skip to content
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

planner: add sub plan info of shuffleReceiver when query explain analyze #27992

Merged
merged 11 commits into from
Nov 23, 2021
3 changes: 2 additions & 1 deletion executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -4142,7 +4142,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 @@ -1226,6 +1226,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 @@ -1326,8 +1326,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