Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#40625
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
qw4990 authored and ti-chi-bot committed Feb 20, 2023
1 parent 772c688 commit 8fb8563
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions planner/core/optimizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,11 @@ func postOptimize(sctx sessionctx.Context, plan PhysicalPlan) (PhysicalPlan, err
mergeContinuousSelections(plan)
plan = eliminateUnionScanAndLock(sctx, plan)
plan = enableParallelApply(sctx, plan)
<<<<<<< HEAD
handleFineGrainedShuffle(sctx, plan)
=======
handleFineGrainedShuffle(ctx, sctx, plan)
>>>>>>> bdc6f4b541 (planner: refactor to put all plan-cacheability-check functions together (#40625))
propagateProbeParents(plan, nil)
countStarRewrite(plan)
disableReuseChunkIfNeeded(sctx, plan)
Expand Down
10 changes: 10 additions & 0 deletions planner/core/plan_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func GetPlanFromSessionPlanCache(ctx context.Context, sctx sessionctx.Context,
}
}

<<<<<<< HEAD
if stmtCtx.UseCache { // for non-point plans
if plan, names, ok, err := getGeneralPlan(sctx, isGeneralPlanCache, cacheKey, bindSQL, is, stmt,
paramTypes); err != nil || ok {
Expand All @@ -167,6 +168,9 @@ func GetPlanFromSessionPlanCache(ctx context.Context, sctx sessionctx.Context,
}

return generateNewPlan(ctx, sctx, isGeneralPlanCache, is, stmt, cacheKey, latestSchemaVersion, paramTypes, bindSQL)
=======
return generateNewPlan(ctx, sctx, isNonPrepared, is, stmt, cacheKey, latestSchemaVersion, paramTypes, bindSQL, limitCountAndOffset)
>>>>>>> bdc6f4b541 (planner: refactor to put all plan-cacheability-check functions together (#40625))
}

// parseParamTypes get parameters' types in PREPARE statement
Expand Down Expand Up @@ -256,9 +260,15 @@ func getGeneralPlan(sctx sessionctx.Context, isGeneralPlanCache bool, cacheKey k

// generateNewPlan call the optimizer to generate a new plan for current statement
// and try to add it to cache
<<<<<<< HEAD
func generateNewPlan(ctx context.Context, sctx sessionctx.Context, isGeneralPlanCache bool, is infoschema.InfoSchema,
stmt *PlanCacheStmt, cacheKey kvcache.Key, latestSchemaVersion int64, paramTypes []*types.FieldType,
bindSQL string) (Plan, []*types.FieldName, error) {
=======
func generateNewPlan(ctx context.Context, sctx sessionctx.Context, isNonPrepared bool, is infoschema.InfoSchema,
stmt *PlanCacheStmt, cacheKey kvcache.Key, latestSchemaVersion int64, paramTypes []*types.FieldType,
bindSQL string, limitParams []uint64) (Plan, []*types.FieldName, error) {
>>>>>>> bdc6f4b541 (planner: refactor to put all plan-cacheability-check functions together (#40625))
stmtAst := stmt.PreparedAst
sessVars := sctx.GetSessionVars()
stmtCtx := sessVars.StmtCtx
Expand Down

0 comments on commit 8fb8563

Please sign in to comment.