From e0cf097968d7fd1a1aee950c65c16b51de4d3462 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Mon, 26 Aug 2024 17:39:16 +0800 Subject: [PATCH] planner: make sure mpp join task's hashCols are all contained of its plan's schema (#52836) (#55655) close pingcap/tidb#42587 --- planner/core/rule_eliminate_projection.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/planner/core/rule_eliminate_projection.go b/planner/core/rule_eliminate_projection.go index a9a1ad250b5b4..a1a998b8c0b92 100644 --- a/planner/core/rule_eliminate_projection.go +++ b/planner/core/rule_eliminate_projection.go @@ -130,7 +130,11 @@ func doPhysicalProjectionElimination(p PhysicalPlan) PhysicalPlan { } child := p.Children()[0] if childProj, ok := child.(*PhysicalProjection); ok { - childProj.SetSchema(p.Schema()) + // when current projection is an empty projection(schema pruned by column pruner), no need to reset child's schema + // TODO: avoid producing empty projection in column pruner. + if p.Schema().Len() != 0 { + childProj.SetSchema(p.Schema()) + } } return child }