Skip to content

Commit

Permalink
planner: make WindowFunction uncacheable in prepare (#11035)
Browse files Browse the repository at this point in the history
  • Loading branch information
winoros authored and alivxxx committed Jul 3, 2019
1 parent e217962 commit d1dc97c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions planner/core/cacheable_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ func (checker *cacheableChecker) Enter(in ast.Node) (out ast.Node, skipChildren
return in, true
}
}
case *ast.FrameBound:
if _, ok := node.Expr.(*driver.ParamMarkerExpr); ok {
checker.cacheable = false
return in, true
}
}
return in, false
}
Expand Down
3 changes: 3 additions & 0 deletions planner/core/cacheable_checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,7 @@ func (s *testCacheableSuite) TestCacheable(c *C) {
OrderBy: orderByClause,
}
c.Assert(Cacheable(stmt), IsTrue)

boundExpr := &ast.FrameBound{Expr: &driver.ParamMarkerExpr{}}
c.Assert(Cacheable(boundExpr), IsFalse)
}

0 comments on commit d1dc97c

Please sign in to comment.