Skip to content

Commit 5f18463

Browse files
committed
fuse_block add vector_index_size
1 parent c767a83 commit 5f18463

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

src/query/storages/fuse/src/table_functions/fuse_block.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ impl TableMetaFunc for FuseBlock {
6767
"ngram_index_size",
6868
TableDataType::Nullable(Box::new(TableDataType::Number(NumberDataType::UInt64))),
6969
),
70+
TableField::new(
71+
"vector_index_size",
72+
TableDataType::Nullable(Box::new(TableDataType::Number(NumberDataType::UInt64))),
73+
),
7074
TableField::new(
7175
"virtual_column_size",
7276
TableDataType::Nullable(Box::new(TableDataType::Number(NumberDataType::UInt64))),
@@ -93,6 +97,7 @@ impl TableMetaFunc for FuseBlock {
9397
let mut bloom_filter_size = Vec::with_capacity(len);
9498
let mut inverted_index_size = Vec::with_capacity(len);
9599
let mut ngram_index_size = Vec::with_capacity(len);
100+
let mut vector_index_size = Vec::with_capacity(len);
96101
let mut virtual_column_size = Vec::with_capacity(len);
97102

98103
let segments_io = SegmentsIO::create(ctx.clone(), tbl.operator.clone(), tbl.schema());
@@ -122,6 +127,7 @@ impl TableMetaFunc for FuseBlock {
122127
bloom_filter_size.push(block.bloom_filter_index_size);
123128
inverted_index_size.push(block.inverted_index_size);
124129
ngram_index_size.push(block.ngram_filter_index_size);
130+
vector_index_size.push(block.vector_index_size);
125131
virtual_column_size.push(
126132
block
127133
.virtual_block_meta
@@ -149,6 +155,7 @@ impl TableMetaFunc for FuseBlock {
149155
UInt64Type::from_data(bloom_filter_size).into(),
150156
UInt64Type::from_opt_data(inverted_index_size).into(),
151157
UInt64Type::from_opt_data(ngram_index_size).into(),
158+
UInt64Type::from_opt_data(vector_index_size).into(),
152159
UInt64Type::from_opt_data(virtual_column_size).into(),
153160
],
154161
num_rows,

tests/sqllogictests/suites/ee/09_ee_vector_index/09_0000_vector_index_base.test

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,38 @@ INSERT INTO t VALUES
7777
(15, [0.13230447, 0.630588, 0.10812326, 0.21558228, 0.83768057, 0.48870546, 0.65021806, 0.31626541]),
7878
(16, [0.2667851, 0.01529589, 0.98994706, 0.31870983, 0.31783372, 0.34863699, 0.30254189, 0.84441678])
7979

80-
8180
statement ok
8281
CREATE TABLE IF NOT EXISTS t1(id Int, embedding Vector(8)) Engine = Fuse
8382

8483
statement ok
8584
INSERT INTO t1 SELECT id, embedding FROM t
8685

86+
query T
87+
EXPLAIN SELECT id, cosine_distance(embedding, [0.50515236, 0.8561939, 0.87169914, 0.55843271, 0.73689797, 0.49985862, 0.64527255, 0.29313098]::vector(8)) AS similarity FROM t ORDER BY similarity ASC LIMIT 5;
88+
----
89+
RowFetch
90+
├── output columns: [t._vector_score (#2), t._row_id (#3), t.id (#0)]
91+
├── columns to fetch: [id]
92+
├── estimated rows: 5.00
93+
└── Limit
94+
├── output columns: [t._vector_score (#2), t._row_id (#3)]
95+
├── limit: 5
96+
├── offset: 0
97+
├── estimated rows: 5.00
98+
└── Sort
99+
├── output columns: [t._vector_score (#2), t._row_id (#3)]
100+
├── sort keys: [_vector_score ASC NULLS LAST]
101+
├── estimated rows: 16.00
102+
└── TableScan
103+
├── table: default.test_vector_index.t
104+
├── output columns: [_vector_score (#2), _row_id (#3)]
105+
├── read rows: 12
106+
├── read size: 0
107+
├── partitions total: 4
108+
├── partitions scanned: 3
109+
├── pruning stats: [segments: <range pruning: 4 to 4>, blocks: <range pruning: 4 to 4, vector pruning: 4 to 3>]
110+
├── push downs: [filters: [], limit: 5]
111+
└── estimated rows: 16.00
87112

88113
query IF
89114
SELECT id, cosine_distance(embedding, [0.50515236, 0.8561939, 0.87169914, 0.55843271, 0.73689797, 0.49985862, 0.64527255, 0.29313098]::vector(8)) AS similarity FROM t ORDER BY similarity ASC LIMIT 5;

tests/sqllogictests/suites/mode/cluster/memo/join_property.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ select * from t_10, t_100, t_1000
203203
----
204204
Memo
205205
├── root group: #5
206-
├── estimated memory: 4.22 KiB
206+
├── estimated memory: 5.34 KiB
207207
├── Group #0
208208
│ ├── Best properties
209209
│ │ └── { dist: Any }: expr: #0, cost: 10.000, children: []

0 commit comments

Comments
 (0)