planner: remove redundant variable handling (#63834)

close pingcap/tidb#63040
This commit is contained in:
Dongpo Liu
2025-10-01 21:24:22 +02:00
committed by GitHub
parent 72a540b804
commit e60e050405

View File

@ -2440,18 +2440,9 @@ func getModifiedIndexesInfoForAnalyze(
// filterSkipColumnTypes filters out columns whose types are in the skipTypes list.
func (b *PlanBuilder) filterSkipColumnTypes(origin []*model.ColumnInfo, tbl *resolve.TableNameW, mustAnalyzedCols *calcOnceMap) (result []*model.ColumnInfo, skipCol []*model.ColumnInfo) {
// If the session is in restricted SQL mode, it uses @@global.tidb_analyze_skip_column_types to get the skipTypes list.
// For auto-analyze, it uses @@global.tidb_analyze_skip_column_types to obtain the skipTypes list.
// This is already handled before executing the query by the CallWithSCtx utility function.
skipTypes := b.ctx.GetSessionVars().AnalyzeSkipColumnTypes
if b.ctx.GetSessionVars().InRestrictedSQL {
// For auto analyze, we need to use @@global.tidb_analyze_skip_column_types.
val, err1 := b.ctx.GetSessionVars().GlobalVarsAccessor.GetGlobalSysVar(vardef.TiDBAnalyzeSkipColumnTypes)
if err1 != nil {
logutil.BgLogger().Error("loading tidb_analyze_skip_column_types failed", zap.Error(err1))
result = origin
return
}
skipTypes = variable.ParseAnalyzeSkipColumnTypes(val)
}
mustAnalyze, err1 := b.getMustAnalyzedColumns(tbl, mustAnalyzedCols)
if err1 != nil {
logutil.BgLogger().Error("getting must-analyzed columns failed", zap.Error(err1))