chore(planner/physical): simplify replace code (#19003)

pull/19004/head
Robert Fratto 8 months ago committed by GitHub
parent b10639054a
commit b972ccb3f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      pkg/engine/planner/physical/plan.go

@ -207,11 +207,10 @@ func (p *Plan) eliminateNode(node Node) {
parent := p.Parent(node)
if parent != nil {
idx := slices.Index(p.children[parent], node)
// First get rid of the node to be deleted
allChildren := append(p.children[parent][0:idx], p.children[parent][idx+1:]...)
// Then insert all the children of the node
allChildren = slices.Insert(allChildren, idx, p.children[node]...)
p.children[parent] = allChildren
// Replace node's entry in the parent's children with the children of node.
oldChildren := p.children[parent]
p.children[parent] = slices.Replace(oldChildren, idx, idx+1, p.children[node]...)
}
for _, child := range p.Children(node) {

Loading…
Cancel
Save