Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
XuHuaiyu committed Oct 17, 2018
1 parent 3854208 commit 89b4c77
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions planner/core/rule_column_pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,13 @@ func (ls *LogicalSort) PruneColumns(parentUsedCols []*expression.Column) {
// PruneColumns implements LogicalPlan interface.
func (p *LogicalUnionAll) PruneColumns(parentUsedCols []*expression.Column) {
used := getUsedList(parentUsedCols, p.schema)
hasBeenUsed := false
for i := range used {
if used[i] {
continue
}
parentUsedCols = append(parentUsedCols, p.schema.Columns[i])
hasBeenUsed = hasBeenUsed || used[i]
}
if !hasBeenUsed {
parentUsedCols = make([]*expression.Column, len(p.schema.Columns))
copy(parentUsedCols, p.schema.Columns)
}
for _, child := range p.Children() {
child.PruneColumns(parentUsedCols)
Expand Down

0 comments on commit 89b4c77

Please sign in to comment.