Skip to content

Commit e9ece74

Browse files
committed
fix: review fixes for TiCI vector query path
- Add RUNTIME_CHECK guards to getMatchExpr/getVectorQueryInfo for mode safety - Remove overly broad null-string check that would crash on any null string column in vector mode, not just vector columns - Make missing vector column check unconditional and use proper RUNTIME_CHECK_MSG pattern instead of RUNTIME_CHECK_MSG(false, ...) - Add reserve() for query_vec copy in readVector() - Remove redundant tici-vector-plan.md (tici-hybrid-vector-plan.md is the canonical doc)
1 parent dceb4ba commit e9ece74

3 files changed

Lines changed: 7 additions & 53 deletions

File tree

dbms/src/Flash/Coprocessor/TiCIScan.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ class TiCIScan
5050

5151
const ::google::protobuf::RepeatedPtrField<::tipb::Expr> & getMatchExpr() const
5252
{
53+
RUNTIME_CHECK(query_mode == TiCIQueryMode::FTS);
5354
return tici_scan->idx_scan().fts_query_info().match_expr();
5455
}
5556

5657
const tipb::TiCIVectorQueryInfo & getVectorQueryInfo() const
5758
{
59+
RUNTIME_CHECK(query_mode == TiCIQueryMode::Vector);
5860
return tici_scan->idx_scan().tici_vector_query_info();
5961
}
6062

dbms/src/Storages/Tantivy/TantivyInputStream.h

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ class TantivyInputStream : public IProfilingBlockInputStream
148148
auto key_ranges = getKeyRanges(shard_info.key_ranges);
149149

150150
rust::Vec<float> query_vec;
151+
query_vec.reserve(vector_state.query_vector.size());
151152
for (auto v : vector_state.query_vector)
152153
query_vec.push_back(v);
153154

@@ -298,13 +299,10 @@ class TantivyInputStream : public IProfilingBlockInputStream
298299
}
299300
continue;
300301
}
301-
if (query_mode == TiCIQueryMode::Vector && isVectorFloat32Type(nested_type))
302-
{
303-
RUNTIME_CHECK_MSG(
304-
false,
305-
"TiCI vector query did not materialize requested vector column {}",
306-
name_and_type.name);
307-
}
302+
RUNTIME_CHECK_MSG(
303+
!isVectorFloat32Type(nested_type),
304+
"TiCI query did not materialize requested vector column {}",
305+
name_and_type.name);
308306
for (size_t j = 0; j < documents.size(); j++)
309307
{
310308
// Insert default value for missing fields
@@ -323,13 +321,6 @@ class TantivyInputStream : public IProfilingBlockInputStream
323321
const auto & field_value = doc.fieldValues[idx];
324322
if (field_value.is_null)
325323
{
326-
if (query_mode == TiCIQueryMode::Vector)
327-
{
328-
RUNTIME_CHECK_MSG(
329-
false,
330-
"TiCI vector query returned null payload for vector column {}",
331-
name_and_type.name);
332-
}
333324
has_null = true;
334325
col->insert(Field());
335326
}

docs/tici-vector-plan.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)