Skip to content

Commit 57f5dd6

Browse files
committed
refactor: rename and update comments
Signed-off-by: Rustin170506 <[email protected]>
1 parent 2d6785d commit 57f5dd6

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

pkg/statistics/handle/bootstrap.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ func (h *Handle) initStatsHistograms4Chunk(is infoschema.InfoSchema, cache stats
282282
}
283283
}
284284

285-
// initStatsHistogramsSQLGen generates the SQL to load all stats_histograms records.
285+
// genInitStatsHistogramsSQL generates the SQL to load all stats_histograms records.
286286
// We need to read all the records since we need to do initialization of table.ColAndIdxExistenceMap.
287-
func initStatsHistogramsSQLGen(isPaging bool) string {
287+
func genInitStatsHistogramsSQL(isPaging bool) string {
288288
selectPrefix := "select /*+ ORDER_INDEX(mysql.stats_histograms,tbl) */ HIGH_PRIORITY table_id, is_index, hist_id, distinct_count, version, null_count, cm_sketch, tot_col_size, stats_ver, correlation, flag, last_analyze_pos from mysql.stats_histograms"
289289
orderSuffix := " order by table_id"
290290
if !isPaging {
@@ -294,7 +294,7 @@ func initStatsHistogramsSQLGen(isPaging bool) string {
294294
}
295295

296296
func (h *Handle) initStatsHistogramsLite(ctx context.Context, cache statstypes.StatsCache) error {
297-
sql := initStatsHistogramsSQLGen(false)
297+
sql := genInitStatsHistogramsSQL(false)
298298
rc, err := util.Exec(h.initStatsCtx, sql)
299299
if err != nil {
300300
return errors.Trace(err)
@@ -317,7 +317,7 @@ func (h *Handle) initStatsHistogramsLite(ctx context.Context, cache statstypes.S
317317
}
318318

319319
func (h *Handle) initStatsHistograms(is infoschema.InfoSchema, cache statstypes.StatsCache) error {
320-
sql := initStatsHistogramsSQLGen(false)
320+
sql := genInitStatsHistogramsSQL(false)
321321
rc, err := util.Exec(h.initStatsCtx, sql)
322322
if err != nil {
323323
return errors.Trace(err)
@@ -351,7 +351,7 @@ func (h *Handle) initStatsHistogramsByPaging(is infoschema.InfoSchema, cache sta
351351
}()
352352

353353
sctx := se.(sessionctx.Context)
354-
sql := initStatsHistogramsSQLGen(true)
354+
sql := genInitStatsHistogramsSQL(true)
355355
rc, err := util.Exec(sctx, sql, task.StartTid, task.EndTid)
356356
if err != nil {
357357
return errors.Trace(err)
@@ -430,10 +430,10 @@ func (*Handle) initStatsTopN4Chunk(cache statstypes.StatsCache, iter *chunk.Iter
430430
}
431431
}
432432

433-
// initStatsTopNSQLGen generates the SQL to load all stats_top_n records.
433+
// genInitStatsTopNSQLForIndexes generates the SQL to load all stats_top_n records for indexes.
434434
// We only need to load the indexes' since we only record the existence of columns in ColAndIdxExistenceMap.
435435
// The stats of the column is not loaded during the bootstrap process.
436-
func initStatsTopNSQLGen(isPaging bool) string {
436+
func genInitStatsTopNSQLForIndexes(isPaging bool) string {
437437
selectPrefix := "select /*+ ORDER_INDEX(mysql.stats_top_n,tbl) */ HIGH_PRIORITY table_id, hist_id, value, count from mysql.stats_top_n where is_index = 1"
438438
orderSuffix := " order by table_id"
439439
if !isPaging {
@@ -443,7 +443,7 @@ func initStatsTopNSQLGen(isPaging bool) string {
443443
}
444444

445445
func (h *Handle) initStatsTopN(cache statstypes.StatsCache, totalMemory uint64) error {
446-
sql := initStatsTopNSQLGen(false)
446+
sql := genInitStatsTopNSQLForIndexes(false)
447447
rc, err := util.Exec(h.initStatsCtx, sql)
448448
if err != nil {
449449
return errors.Trace(err)
@@ -476,7 +476,7 @@ func (h *Handle) initStatsTopNByPaging(cache statstypes.StatsCache, task initsta
476476
}
477477
}()
478478
sctx := se.(sessionctx.Context)
479-
sql := initStatsTopNSQLGen(true)
479+
sql := genInitStatsTopNSQLForIndexes(true)
480480
rc, err := util.Exec(sctx, sql, task.StartTid, task.EndTid)
481481
if err != nil {
482482
return errors.Trace(err)
@@ -614,10 +614,10 @@ func (*Handle) initStatsBuckets4Chunk(cache statstypes.StatsCache, iter *chunk.I
614614
}
615615
}
616616

617-
// initStatsBucketsSQLGen generates the SQL to load all stats_top_n records.
617+
// genInitStatsBucketsSQLForIndexes generates the SQL to load all stats_buckets records for indexes.
618618
// We only need to load the indexes' since we only record the existence of columns in ColAndIdxExistenceMap.
619619
// The stats of the column is not loaded during the bootstrap process.
620-
func initStatsBucketsSQLGen(isPaging bool) string {
620+
func genInitStatsBucketsSQLForIndexes(isPaging bool) string {
621621
selectPrefix := "select /*+ ORDER_INDEX(mysql.stats_buckets,tbl) */ HIGH_PRIORITY table_id, hist_id, count, repeats, lower_bound, upper_bound, ndv from mysql.stats_buckets where is_index=1"
622622
orderSuffix := " order by table_id"
623623
if !isPaging {
@@ -636,7 +636,7 @@ func (h *Handle) initStatsBuckets(cache statstypes.StatsCache, totalMemory uint6
636636
return errors.Trace(err)
637637
}
638638
} else {
639-
sql := initStatsBucketsSQLGen(false)
639+
sql := genInitStatsBucketsSQLForIndexes(false)
640640
rc, err := util.Exec(h.initStatsCtx, sql)
641641
if err != nil {
642642
return errors.Trace(err)
@@ -675,7 +675,7 @@ func (h *Handle) initStatsBucketsByPaging(cache statstypes.StatsCache, task init
675675
}
676676
}()
677677
sctx := se.(sessionctx.Context)
678-
sql := initStatsBucketsSQLGen(true)
678+
sql := genInitStatsBucketsSQLForIndexes(true)
679679
rc, err := util.Exec(sctx, sql, task.StartTid, task.EndTid)
680680
if err != nil {
681681
return errors.Trace(err)

0 commit comments

Comments
 (0)