Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner: correct the vector index tests #58039

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,60 @@
{
"SQL": "explain format = 'brief' select * from t1;",
"Plan": [
"TableReader 10000.00 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
"TableReader 49152.00 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 49152.00 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select * from t1 where a<1;",
"Plan": [
"TableReader 3323.33 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 3323.33 mpp[tiflash] ExchangeType: PassThrough",
" └─Selection 3323.33 mpp[tiflash] lt(test.t1.a, 1)",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
"TableReader 16334.85 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 16334.85 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 16334.85 mpp[tiflash] table:t1 pushed down filter:lt(test.t1.a, 1), keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select * from t1 where vec = '[1,1,1]'",
"Plan": [
"TableReader 10.00 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 10.00 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 10.00 mpp[tiflash] table:t1 pushed down filter:eq(test.t1.vec, [1,1,1]), keep order:false, stats:pseudo"
"TableReader 49.15 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 49.15 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 49.15 mpp[tiflash] table:t1 pushed down filter:eq(test.t1.vec, [1,1,1]), keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select * from t1 where vec_cosine_distance(vec, '[1,1,1]') < 0.1",
"Plan": [
"TableReader 8000.00 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Selection 8000.00 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
"TableReader 39321.60 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 39321.60 mpp[tiflash] ExchangeType: PassThrough",
" └─Selection 39321.60 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select vec_cosine_distance(vec, '[1,1,1]') as dis from t1 having dis < 0.1",
"Plan": [
"TableReader 8000.00 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 8000.00 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─Selection 8000.00 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
"TableReader 39321.60 root MppVersion: 2, data:ExchangeSender",
"└─ExchangeSender 39321.60 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 39321.60 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─Selection 39321.60 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select * from t1 order by vec_cosine_distance(vec, '[1,1,1]')",
"Plan": [
"Projection 10000.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
"└─Sort 10000.00 root Column#7",
" └─Projection 10000.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender",
" └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
"Projection 49152.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
"└─Sort 49152.00 root Column#7",
" └─Projection 49152.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableReader 49152.00 root MppVersion: 2, data:ExchangeSender",
" └─ExchangeSender 49152.00 mpp[tiflash] ExchangeType: PassThrough",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand Down Expand Up @@ -103,8 +102,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7:desc, offset:0, count:1",
" └─Projection 10000.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -118,8 +117,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7:desc, offset:0, count:1",
" └─Projection 10000.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -133,8 +132,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 10000.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, plus(vec_cosine_distance(test.t1.vec, [1,1,1]), 1)->Column#7",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, plus(vec_cosine_distance(test.t1.vec, [1,1,1]), 1)->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -148,8 +147,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, test.t1.vec, offset:0, count:1",
" └─Projection 10000.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -163,8 +162,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 10000.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -178,8 +177,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 10000.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -193,8 +192,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 10000.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.c, [1,1,1])->Column#7",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.c, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -208,8 +207,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 10000.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -223,8 +222,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 10000.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand All @@ -238,19 +237,19 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 10000.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.d, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
{
"SQL": "explain format = 'brief' select vec_cosine_distance(vec, '[1,1,1]') as d from t1 order by d",
"Plan": [
"Sort 10000.00 root Column#7",
"└─TableReader 10000.00 root MppVersion: 2, data:ExchangeSender",
" └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 10000.00 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 10000.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
"Sort 49152.00 root Column#7",
"└─TableReader 49152.00 root MppVersion: 2, data:ExchangeSender",
" └─ExchangeSender 49152.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 49152.00 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
],
"Warn": null
},
Expand Down Expand Up @@ -296,8 +295,8 @@
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
" └─Projection 10.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 10.00 mpp[tiflash] table:t1 pushed down filter:eq(test.t1.a, 0), keep order:false, stats:pseudo"
" └─Projection 49.15 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
" └─TableFullScan 49.15 mpp[tiflash] table:t1 pushed down filter:eq(test.t1.a, 0), keep order:false, stats:pseudo"
],
"Warn": null
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/planner/core/casetest/vectorsearch/vector_index_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ func TestTiFlashANNIndex(t *testing.T) {
}
dom := domain.GetDomain(tk.Session())
testkit.SetTiFlashReplica(t, dom, "test", "t1")
handle := dom.StatsHandle()
require.NoError(t, handle.HandleDDLEvent(<-handle.DDLEventCh()))
tk.MustExec("analyze table t1")

tk.MustExec("set @@tidb_isolation_read_engines = 'tiflash'")
Expand Down