diff --git a/pkg/statistics/handle/bootstrap.go b/pkg/statistics/handle/bootstrap.go index c354fb9d9d911..efde5b994aac2 100644 --- a/pkg/statistics/handle/bootstrap.go +++ b/pkg/statistics/handle/bootstrap.go @@ -134,7 +134,7 @@ func (*Handle) initStatsHistograms4ChunkLite(cache statstypes.StatsCache, iter * id := row.GetInt64(2) ndv := row.GetInt64(3) nullCount := row.GetInt64(5) - statsVer := row.GetInt64(7) + statsVer := row.GetInt64(8) // All the objects in the table share the same stats version. if statsVer != statistics.Version0 { table.StatsVer = int(statsVer) diff --git a/pkg/statistics/handle/handletest/handle_test.go b/pkg/statistics/handle/handletest/handle_test.go index 5307cf95ca866..ad07df8879ab6 100644 --- a/pkg/statistics/handle/handletest/handle_test.go +++ b/pkg/statistics/handle/handletest/handle_test.go @@ -1414,6 +1414,7 @@ func TestInitStatsLite(t *testing.T) { require.NoError(t, h.InitStatsLite(context.Background())) statsTbl1 := h.GetTableStats(tblInfo) checkAllEvicted(t, statsTbl1) + require.Equal(t, int(statistics.Version2), statsTbl1.StatsVer) { // internal.AssertTableEqual(t, statsTbl0, statsTbl1) // statsTbl0 is loaded when the cache has pseudo table.