Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Dousir9 committed Jan 30, 2023
1 parent dd9ac2d commit 1a3ce1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions planner/core/rule_topn_push_down.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ func (p *LogicalProjection) pushDownTopN(topN *LogicalTopN, opt *logicalOptimize
}
}

// if the projection contains a column(with ID=0) in topN.ByItems, projection will prevent the optimizer from pushing topN down.
// if topN.ByItems contains a column(with ID=0) generated by projection, projection will prevent the optimizer from pushing topN down.
for _, by := range topN.ByItems {
cols := expression.ExtractColumns(by.Expr)
for _, col := range cols {
if col.ID == 0 && p.Schema().Contains(col) {
// check whether the column is generated by projection
if !p.children[0].Schema().Contains(col) {
// the column is generated by projection
p.children[0] = p.children[0].pushDownTopN(nil, opt)
return topN.setChild(p, opt)
}
Expand Down

0 comments on commit 1a3ce1b

Please sign in to comment.