mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
fix: [ut] regex query under unsupported index (#34087)
/kind improvement issue: https://github.com/milvus-io/milvus/issues/29988 Signed-off-by: longjiquan <jiquan.long@zilliz.com>
This commit is contained in:
parent
d08cb885ca
commit
aa36f9feed
@ -479,28 +479,33 @@ TEST_F(SealedSegmentRegexQueryTest, RegexQueryOnInvertedIndexStringField) {
|
||||
ASSERT_TRUE(final[4]);
|
||||
}
|
||||
|
||||
// TODO: optimize this case
|
||||
// TEST_F(SealedSegmentRegexQueryTest, RegexQueryOnUnsupportedIndex) {
|
||||
// std::string operand = "a%";
|
||||
// const auto& str_meta = schema->operator[](FieldName("str"));
|
||||
// auto column_info = test::GenColumnInfo(str_meta.get_id().get(),
|
||||
// proto::schema::DataType::VarChar,
|
||||
// false,
|
||||
// false);
|
||||
// auto unary_range_expr = test::GenUnaryRangeExpr(OpType::Match, operand);
|
||||
// unary_range_expr->set_allocated_column_info(column_info);
|
||||
// auto expr = test::GenExpr();
|
||||
// expr->set_allocated_unary_range_expr(unary_range_expr);
|
||||
TEST_F(SealedSegmentRegexQueryTest, RegexQueryOnUnsupportedIndex) {
|
||||
std::string operand = "a%";
|
||||
const auto& str_meta = schema->operator[](FieldName("str"));
|
||||
auto column_info = test::GenColumnInfo(str_meta.get_id().get(),
|
||||
proto::schema::DataType::VarChar,
|
||||
false,
|
||||
false);
|
||||
auto unary_range_expr = test::GenUnaryRangeExpr(OpType::Match, operand);
|
||||
unary_range_expr->set_allocated_column_info(column_info);
|
||||
auto expr = test::GenExpr();
|
||||
expr->set_allocated_unary_range_expr(unary_range_expr);
|
||||
|
||||
// auto parser = ProtoParser(*schema);
|
||||
// auto typed_expr = parser.ParseExprs(*expr);
|
||||
// auto parsed =
|
||||
// std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, typed_expr);
|
||||
auto parser = ProtoParser(*schema);
|
||||
auto typed_expr = parser.ParseExprs(*expr);
|
||||
auto parsed =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, typed_expr);
|
||||
|
||||
// LoadMockIndex();
|
||||
LoadMockIndex();
|
||||
|
||||
// auto segpromote = dynamic_cast<SegmentSealedImpl*>(seg.get());
|
||||
// query::ExecPlanNodeVisitor visitor(*segpromote, MAX_TIMESTAMP);
|
||||
// BitsetType final;
|
||||
// ASSERT_ANY_THROW(visitor.ExecuteExprNode(parsed, segpromote, N, final));
|
||||
// }
|
||||
auto segpromote = dynamic_cast<SegmentSealedImpl*>(seg.get());
|
||||
query::ExecPlanNodeVisitor visitor(*segpromote, MAX_TIMESTAMP);
|
||||
BitsetType final;
|
||||
// regex query under this index will be executed using raw data (brute force).
|
||||
visitor.ExecuteExprNode(parsed, segpromote, N, final);
|
||||
ASSERT_FALSE(final[0]);
|
||||
ASSERT_TRUE(final[1]);
|
||||
ASSERT_TRUE(final[2]);
|
||||
ASSERT_TRUE(final[3]);
|
||||
ASSERT_TRUE(final[4]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user