Skip to content

Commit

Permalink
Merge pull request #12617 from knz/opt-filters2
Browse files Browse the repository at this point in the history
sql: implement filter propagation.
  • Loading branch information
knz authored Jan 12, 2017
2 parents 3e31754 + 2209f37 commit b8da7e8
Show file tree
Hide file tree
Showing 12 changed files with 955 additions and 81 deletions.
11 changes: 1 addition & 10 deletions pkg/sql/expand_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,20 +279,11 @@ func (p *planner) expandSelectNode(s *renderNode) (planNode, error) {
limitCount, limitOffset := s.top.limit.estimateLimit()

maybeScanNode := s.source.plan
var whereFilter parser.TypedExpr
where, ok := maybeScanNode.(*filterNode)
if ok {
whereFilter = where.filter
if where, ok := maybeScanNode.(*filterNode); ok {
maybeScanNode = where.source.plan
}

if scan, ok := maybeScanNode.(*scanNode); ok {
if whereFilter != nil {
// Migrate the filter to the scan node.
// (Will be done soon by filter propagation.)
scan.filter = scan.filterVars.Rebind(whereFilter)
}

var analyzeOrdering analyzeOrderingFn
if ordering != nil {
analyzeOrdering = func(indexOrdering orderingInfo) (matchingCols, totalCols int) {
Expand Down
Loading

0 comments on commit b8da7e8

Please sign in to comment.