planner: enable revive for all planner (#44900)
close pingcap/tidb#44113
This commit is contained in:
@ -492,13 +492,6 @@
|
||||
"dumpling/export/sql_type.go": "please fix it",
|
||||
".*_test\\.go$": "ignore generated code",
|
||||
".*_generated\\.go$": "ignore generated code",
|
||||
"planner/core/resolve_indices.go": "planner/core/resolve_indices.go",
|
||||
"planner/core/indexmerge_path.go": "planner/core/indexmerge_path.go",
|
||||
"planner/core/rule_join_reorder.go": "planner/core/rule_join_reorder.go",
|
||||
"planner/core/plan_cacheable_checker.go": "planner/core/plan_cacheable_checker.go",
|
||||
"planner/core/rule_decorrelate.go": "planner/core/rule_decorrelate.go",
|
||||
"planner/core/plan_cache_utils.go": "planner/core/plan_cache_utils.go",
|
||||
"planner/core/expression_rewriter.go": "planner/core/expression_rewriter.go",
|
||||
"plugin/conn_ip_example/": "plugin/conn_ip_example/"
|
||||
},
|
||||
"only_files": {
|
||||
@ -515,7 +508,6 @@
|
||||
"server/conn.go": "server/conn.go",
|
||||
"server/conn_stmt.go": "server/conn_stmt.go",
|
||||
"server/conn_test.go": "server/conn_test.go",
|
||||
"planner/core/rule_partition_eliminate.go": "planner/core/rule_partition_eliminate code",
|
||||
"distsql/": "ignore distsql code",
|
||||
"disttask": "disttask code",
|
||||
"dumpling/export": "dumpling/export code",
|
||||
|
||||
@ -178,7 +178,7 @@ func (b *PlanBuilder) getExpressionRewriter(ctx context.Context, p LogicalPlan)
|
||||
return
|
||||
}
|
||||
|
||||
func (b *PlanBuilder) rewriteExprNode(rewriter *expressionRewriter, exprNode ast.ExprNode, asScalar bool) (expression.Expression, LogicalPlan, error) {
|
||||
func (*PlanBuilder) rewriteExprNode(rewriter *expressionRewriter, exprNode ast.ExprNode, asScalar bool) (expression.Expression, LogicalPlan, error) {
|
||||
if rewriter.p != nil {
|
||||
curColLen := rewriter.p.Schema().Len()
|
||||
defer func() {
|
||||
@ -867,10 +867,10 @@ func (er *expressionRewriter) handleExistSubquery(ctx context.Context, v *ast.Ex
|
||||
er.ctxStackAppend(er.p.Schema().Columns[er.p.Schema().Len()-1], er.p.OutputNames()[er.p.Schema().Len()-1])
|
||||
} else {
|
||||
// We don't want nth_plan hint to affect separately executed subqueries here, so disable nth_plan temporarily.
|
||||
NthPlanBackup := er.sctx.GetSessionVars().StmtCtx.StmtHints.ForceNthPlan
|
||||
nthPlanBackup := er.sctx.GetSessionVars().StmtCtx.StmtHints.ForceNthPlan
|
||||
er.sctx.GetSessionVars().StmtCtx.StmtHints.ForceNthPlan = -1
|
||||
physicalPlan, _, err := DoOptimize(ctx, er.sctx, er.b.optFlag, np)
|
||||
er.sctx.GetSessionVars().StmtCtx.StmtHints.ForceNthPlan = NthPlanBackup
|
||||
er.sctx.GetSessionVars().StmtCtx.StmtHints.ForceNthPlan = nthPlanBackup
|
||||
if err != nil {
|
||||
er.err = err
|
||||
return v, true
|
||||
@ -1078,10 +1078,10 @@ func (er *expressionRewriter) handleScalarSubquery(ctx context.Context, v *ast.S
|
||||
return v, true
|
||||
}
|
||||
// We don't want nth_plan hint to affect separately executed subqueries here, so disable nth_plan temporarily.
|
||||
NthPlanBackup := er.sctx.GetSessionVars().StmtCtx.StmtHints.ForceNthPlan
|
||||
nthPlanBackup := er.sctx.GetSessionVars().StmtCtx.StmtHints.ForceNthPlan
|
||||
er.sctx.GetSessionVars().StmtCtx.StmtHints.ForceNthPlan = -1
|
||||
physicalPlan, _, err := DoOptimize(ctx, er.sctx, er.b.optFlag, np)
|
||||
er.sctx.GetSessionVars().StmtCtx.StmtHints.ForceNthPlan = NthPlanBackup
|
||||
er.sctx.GetSessionVars().StmtCtx.StmtHints.ForceNthPlan = nthPlanBackup
|
||||
if err != nil {
|
||||
er.err = err
|
||||
return v, true
|
||||
@ -1347,7 +1347,7 @@ func (er *expressionRewriter) newFunction(funcName string, retType *types.FieldT
|
||||
return
|
||||
}
|
||||
|
||||
func (er *expressionRewriter) checkTimePrecision(ft *types.FieldType) error {
|
||||
func (*expressionRewriter) checkTimePrecision(ft *types.FieldType) error {
|
||||
if ft.EvalType() == types.ETDuration && ft.GetDecimal() > types.MaxFsp {
|
||||
return errTooBigPrecision.GenWithStackByArgs(ft.GetDecimal(), "CAST", types.MaxFsp)
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ func (ds *DataSource) accessPathsForConds(conditions []expression.Expression, us
|
||||
|
||||
// buildIndexMergePartialPath chooses the best index path from all possible paths.
|
||||
// Now we choose the index with minimal estimate row count.
|
||||
func (ds *DataSource) buildIndexMergePartialPath(indexAccessPaths []*util.AccessPath) (*util.AccessPath, error) {
|
||||
func (*DataSource) buildIndexMergePartialPath(indexAccessPaths []*util.AccessPath) (*util.AccessPath, error) {
|
||||
if len(indexAccessPaths) == 1 {
|
||||
return indexAccessPaths[0], nil
|
||||
}
|
||||
@ -650,7 +650,7 @@ func (ds *DataSource) generateIndexMerge4MVIndex(normalPathCnt int, filters []ex
|
||||
}
|
||||
|
||||
// buildPartialPathUp4MVIndex builds these partial paths up to a complete index merge path.
|
||||
func (ds *DataSource) buildPartialPathUp4MVIndex(partialPaths []*util.AccessPath, isIntersection bool, remainingFilters []expression.Expression) *util.AccessPath {
|
||||
func (*DataSource) buildPartialPathUp4MVIndex(partialPaths []*util.AccessPath, isIntersection bool, remainingFilters []expression.Expression) *util.AccessPath {
|
||||
indexMergePath := &util.AccessPath{PartialIndexPaths: partialPaths, IndexMergeAccessMVIndex: true}
|
||||
indexMergePath.IndexMergeIsIntersection = isIntersection
|
||||
indexMergePath.TableFilters = remainingFilters
|
||||
|
||||
@ -63,7 +63,7 @@ type paramMarkerExtractor struct {
|
||||
markers []ast.ParamMarkerExpr
|
||||
}
|
||||
|
||||
func (e *paramMarkerExtractor) Enter(in ast.Node) (ast.Node, bool) {
|
||||
func (*paramMarkerExtractor) Enter(in ast.Node) (ast.Node, bool) {
|
||||
return in, false
|
||||
}
|
||||
|
||||
@ -111,8 +111,8 @@ func GeneratePlanCacheStmtWithAST(ctx context.Context, sctx sessionctx.Context,
|
||||
slices.SortFunc(extractor.markers, func(i, j ast.ParamMarkerExpr) bool {
|
||||
return i.(*driver.ParamMarkerExpr).Offset < j.(*driver.ParamMarkerExpr).Offset
|
||||
})
|
||||
ParamCount := len(extractor.markers)
|
||||
for i := 0; i < ParamCount; i++ {
|
||||
paramCount := len(extractor.markers)
|
||||
for i := 0; i < paramCount; i++ {
|
||||
extractor.markers[i].SetOrder(i)
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ func GeneratePlanCacheStmtWithAST(ctx context.Context, sctx sessionctx.Context,
|
||||
if err = CheckPreparedPriv(sctx, preparedObj, ret.InfoSchema); err != nil {
|
||||
return nil, nil, 0, err
|
||||
}
|
||||
return preparedObj, p, ParamCount, nil
|
||||
return preparedObj, p, paramCount, nil
|
||||
}
|
||||
|
||||
// planCacheKey is used to access Plan Cache. We put some variables that do not affect the plan into planCacheKey, such as the sql text.
|
||||
@ -420,7 +420,7 @@ func (f *PlanCacheQueryFeatures) Enter(in ast.Node) (out ast.Node, skipChildren
|
||||
}
|
||||
|
||||
// Leave implements Visitor interface.
|
||||
func (f *PlanCacheQueryFeatures) Leave(in ast.Node) (out ast.Node, ok bool) {
|
||||
func (*PlanCacheQueryFeatures) Leave(in ast.Node) (out ast.Node, ok bool) {
|
||||
return in, true
|
||||
}
|
||||
|
||||
|
||||
@ -547,7 +547,7 @@ func (checker *nonPreparedPlanCacheableChecker) Leave(in ast.Node) (out ast.Node
|
||||
return in, checker.cacheable
|
||||
}
|
||||
|
||||
func (checker *nonPreparedPlanCacheableChecker) isFilterNode(node ast.Node) bool {
|
||||
func (*nonPreparedPlanCacheableChecker) isFilterNode(node ast.Node) bool {
|
||||
switch node.(type) {
|
||||
case *ast.BetweenExpr, *ast.PatternInExpr, *ast.BinaryOperationExpr:
|
||||
return true
|
||||
|
||||
@ -765,7 +765,7 @@ func (p *physicalSchemaProducer) ResolveIndices() (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *baseSchemaProducer) ResolveIndices() (err error) {
|
||||
func (*baseSchemaProducer) ResolveIndices() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ func extractOuterApplyCorrelatedColsHelper(p PhysicalPlan, outerSchemas []*expre
|
||||
// decorrelateSolver tries to convert apply plan to join plan.
|
||||
type decorrelateSolver struct{}
|
||||
|
||||
func (s *decorrelateSolver) aggDefaultValueMap(agg *LogicalAggregation) map[int]*expression.Constant {
|
||||
func (*decorrelateSolver) aggDefaultValueMap(agg *LogicalAggregation) map[int]*expression.Constant {
|
||||
defaultValueMap := make(map[int]*expression.Constant, len(agg.AggFuncs))
|
||||
for i, f := range agg.AggFuncs {
|
||||
switch f.Name {
|
||||
|
||||
@ -642,7 +642,7 @@ func (s *baseSingleGroupJoinOrderSolver) setNewJoinWithHint(newJoin *LogicalJoin
|
||||
}
|
||||
|
||||
// calcJoinCumCost calculates the cumulative cost of the join node.
|
||||
func (s *baseSingleGroupJoinOrderSolver) calcJoinCumCost(join LogicalPlan, lNode, rNode *jrNode) float64 {
|
||||
func (*baseSingleGroupJoinOrderSolver) calcJoinCumCost(join LogicalPlan, lNode, rNode *jrNode) float64 {
|
||||
return join.statsInfo().RowCount + lNode.cumCost + rNode.cumCost
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user