Skip to content

Commit

Permalink
planner: use switch to simple code (#49948)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Jan 2, 2024
1 parent 7af117d commit 2ab23da
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pkg/planner/core/plan_cacheable_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,9 @@ func CacheableWithCtx(sctx sessionctx.Context, node ast.Node, is infoschema.Info
// Handle "ignore_plan_cache()" hint
// If there are multiple hints, only one will take effect
func IsASTCacheable(ctx context.Context, sctx sessionctx.Context, node ast.Node, is infoschema.InfoSchema) (bool, string) {
_, isSelect := node.(*ast.SelectStmt)
_, isUpdate := node.(*ast.UpdateStmt)
_, isInsert := node.(*ast.InsertStmt)
_, isDelete := node.(*ast.DeleteStmt)
_, isSetOpr := node.(*ast.SetOprStmt)
if !(isSelect || isUpdate || isInsert || isDelete || isSetOpr) {
switch node.(type) {
case *ast.SelectStmt, *ast.UpdateStmt, *ast.InsertStmt, *ast.DeleteStmt, *ast.SetOprStmt:
default:
return false, "not a SELECT/UPDATE/INSERT/DELETE/SET statement"
}
checker := cacheableChecker{
Expand Down

0 comments on commit 2ab23da

Please sign in to comment.