diff --git a/executor/builder.go b/executor/builder.go index c277eb8e91b79..d75299884ca0c 100644 --- a/executor/builder.go +++ b/executor/builder.go @@ -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) diff --git a/planner/core/common_plans.go b/planner/core/common_plans.go index 29dfecfb5481a..13029e49847f4 100644 --- a/planner/core/common_plans.go +++ b/planner/core/common_plans.go @@ -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 } diff --git a/planner/core/physical_plans.go b/planner/core/physical_plans.go index b7a5698bc2509..f9cdca27dc42f 100644 --- a/planner/core/physical_plans.go +++ b/planner/core/physical_plans.go @@ -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.