Skip to content

Commit

Permalink
fix: set iterative filter hint to false when no expr specified (milvu…
Browse files Browse the repository at this point in the history
…s-io#39033)

issue: milvus-io#39013

Signed-off-by: chasingegg <chao.gao@zilliz.com>
  • Loading branch information
chasingegg authored Jan 8, 2025
1 parent f076898 commit f0dae81
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/core/src/query/PlanProto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ ProtoParser::PlanNodeFromProto(const planpb::PlanNode& plan_node_proto) {
pre_filter_plan();
}
} else {
// no filter, force set iterative filter hint to false, go with normal vector search path
plan_node->search_info_.iterative_filter_execution = false;
plannode = std::make_shared<milvus::plan::MvccNode>(
milvus::plan::GetNextPlanNodeId(), sources);
sources = std::vector<milvus::plan::PlanNodePtr>{plannode};
Expand Down
41 changes: 41 additions & 0 deletions internal/core/unittest/test_iterative_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,47 @@ TEST(IterativeFilter, SealedIndex) {
CheckFilterSearchResult(
*search_result, *search_result2, topK, num_queries);
}

// no expr
{
const char* raw_plan = R"(vector_anns: <
field_id: 100
query_info: <
topk: 10
metric_type: "L2"
hints: "iterative_filter"
search_params: "{\"ef\": 50}"
>
placeholder_tag: "$0">)";
proto::plan::PlanNode plan_node;
auto ok =
google::protobuf::TextFormat::ParseFromString(raw_plan, &plan_node);
auto plan = CreateSearchPlanFromPlanNode(*schema, plan_node);
auto num_queries = 1;
auto seed = 1024;
auto ph_group_raw = CreatePlaceholderGroup(num_queries, dim, seed);
auto ph_group =
ParsePlaceholderGroup(plan.get(), ph_group_raw.SerializeAsString());
auto search_result =
segment->Search(plan.get(), ph_group.get(), 1L << 63);

const char* raw_plan2 = R"(vector_anns: <
field_id: 100
query_info: <
topk: 10
metric_type: "L2"
search_params: "{\"ef\": 50}"
>
placeholder_tag: "$0">)";
proto::plan::PlanNode plan_node2;
auto ok2 = google::protobuf::TextFormat::ParseFromString(raw_plan2,
&plan_node2);
auto plan2 = CreateSearchPlanFromPlanNode(*schema, plan_node2);
auto search_result2 =
segment->Search(plan2.get(), ph_group.get(), 1L << 63);
CheckFilterSearchResult(
*search_result, *search_result2, topK, num_queries);
}
}

TEST(IterativeFilter, SealedData) {
Expand Down

0 comments on commit f0dae81

Please sign in to comment.