From d1dc97c6c65e95140fff2c8ebc39d927404470f3 Mon Sep 17 00:00:00 2001 From: Yiding Cui Date: Wed, 3 Jul 2019 11:07:39 +0800 Subject: [PATCH] planner: make WindowFunction uncacheable in prepare (#11035) --- planner/core/cacheable_checker.go | 5 +++++ planner/core/cacheable_checker_test.go | 3 +++ 2 files changed, 8 insertions(+) diff --git a/planner/core/cacheable_checker.go b/planner/core/cacheable_checker.go index 49e08eb8227b1..f4ef4f9c22b6d 100644 --- a/planner/core/cacheable_checker.go +++ b/planner/core/cacheable_checker.go @@ -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 } diff --git a/planner/core/cacheable_checker_test.go b/planner/core/cacheable_checker_test.go index 8f3d287701533..6d195c25f4b27 100644 --- a/planner/core/cacheable_checker_test.go +++ b/planner/core/cacheable_checker_test.go @@ -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) }