Skip to content

Commit

Permalink
planner: do not reset child projection's schema (#52836) (#55109)
Browse files Browse the repository at this point in the history
close #42587
  • Loading branch information
ti-chi-bot authored Aug 1, 2024
1 parent e949990 commit 1467451
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/planner/core/rule_eliminate_projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,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())
}
}
for i, col := range p.Schema().Columns {
if p.SCtx().GetSessionVars().StmtCtx.ColRefFromUpdatePlan.Has(int(col.UniqueID)) && !child.Schema().Columns[i].Equal(nil, col) {
Expand Down

0 comments on commit 1467451

Please sign in to comment.