diff --git a/internal/core/unittest/test_regex_query.cpp b/internal/core/unittest/test_regex_query.cpp index 9b03cb5376..455a582d7a 100644 --- a/internal/core/unittest/test_regex_query.cpp +++ b/internal/core/unittest/test_regex_query.cpp @@ -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(DEFAULT_PLANNODE_ID, typed_expr); + auto parser = ProtoParser(*schema); + auto typed_expr = parser.ParseExprs(*expr); + auto parsed = + std::make_shared(DEFAULT_PLANNODE_ID, typed_expr); -// LoadMockIndex(); + LoadMockIndex(); -// auto segpromote = dynamic_cast(seg.get()); -// query::ExecPlanNodeVisitor visitor(*segpromote, MAX_TIMESTAMP); -// BitsetType final; -// ASSERT_ANY_THROW(visitor.ExecuteExprNode(parsed, segpromote, N, final)); -// } + auto segpromote = dynamic_cast(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]); +}