Skip to content

Commit

Permalink
This is an automated cherry-pick of #52218
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
winoros authored and ti-chi-bot committed Jan 24, 2025
1 parent 5e39597 commit 508829a
Show file tree
Hide file tree
Showing 8 changed files with 2,925 additions and 44 deletions.
11 changes: 8 additions & 3 deletions executor/analyzetest/analyze_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1721,9 +1721,9 @@ func TestAnalyzeColumnsWithDynamicPartitionTable(t *testing.T) {
tk.MustQuery("show stats_buckets where db_name = 'test' and table_name = 't' and is_index = 0").Sort().Check(
// db, tbl, part, col, is_index, bucket_id, count, repeats, lower, upper, ndv
testkit.Rows("test t global a 0 0 5 2 1 4 0",
"test t global a 0 1 12 2 17 17 0",
"test t global a 0 1 12 2 11 17 0",
"test t global c 0 0 6 1 2 6 0",
"test t global c 0 1 14 2 13 13 0",
"test t global c 0 1 14 2 7 13 0",
"test t p0 a 0 0 2 1 1 2 0",
"test t p0 a 0 1 3 1 3 3 0",
"test t p0 c 0 0 3 1 3 5 0",
Expand All @@ -1736,7 +1736,7 @@ func TestAnalyzeColumnsWithDynamicPartitionTable(t *testing.T) {
tk.MustQuery("show stats_buckets where db_name = 'test' and table_name = 't' and is_index = 1").Sort().Check(
// db, tbl, part, col, is_index, bucket_id, count, repeats, lower, upper, ndv
testkit.Rows("test t global idx 1 0 6 1 2 6 0",
"test t global idx 1 1 14 2 13 13 0",
"test t global idx 1 1 14 2 7 13 0",
"test t p0 idx 1 0 3 1 3 5 0",
"test t p0 idx 1 1 4 1 6 6 0",
"test t p1 idx 1 0 4 1 7 10 0",
Expand Down Expand Up @@ -2992,8 +2992,13 @@ PARTITION BY RANGE ( a ) (
require.NoError(t, h.LoadNeededHistograms())
tbl := h.GetTableStats(tableInfo)
lastVersion := tbl.Version
<<<<<<< HEAD:executor/analyzetest/analyze_test.go
require.Equal(t, 3, len(tbl.Columns[tableInfo.Columns[2].ID].Buckets))
require.Equal(t, 3, len(tbl.Columns[tableInfo.Columns[3].ID].Buckets))
=======
require.Equal(t, 2, len(tbl.GetCol(tableInfo.Columns[2].ID).Buckets))
require.Equal(t, 3, len(tbl.GetCol(tableInfo.Columns[3].ID).Buckets))
>>>>>>> a5d2d28d017 (statistics: fix the potential error when merging global stats (#52218)):pkg/executor/test/analyzetest/analyze_test.go

tk.MustExec("analyze table t partition p1 index idx with 1 topn, 2 buckets")
tk.MustQuery("show warnings").Sort().Check(testkit.Rows())
Expand Down
Loading

0 comments on commit 508829a

Please sign in to comment.