github-actions[bot] commented on code in PR #32429:
URL: https://github.com/apache/doris/pull/32429#discussion_r1528917843
##########
be/test/olap/delete_handler_test.cpp:
##########
@@ -1190,4 +1190,44 @@ TEST_F(TestDeleteHandler, FilterDataVersion) {
EXPECT_EQ(Status::OK(), res);
}
+// clang-format off
+TEST_F(TestDeleteHandler, TestParseDeleteCondition) {
+ auto test = [](const std::tuple<std::string, bool, TCondition>& in) {
+ auto& [cond_str, exp_succ, exp_cond] = in;
+ TCondition parsed_cond;
+ EXPECT_EQ(DeleteHandler::parse_condition(cond_str, &parsed_cond),
exp_succ) << " unexpected result, cond_str: " << cond_str;
+ if (exp_succ) EXPECT_EQ(parsed_cond, exp_cond) << " unexpected result,
cond_str: " << cond_str;
+ };
+
+ auto gen_cond = [](const std::string& col, const std::string& op, const
std::string& val) {
+ TCondition cond;
+ cond.__set_column_name(col);
+ cond.__set_condition_op(op);
+ cond.__set_condition_values(std::vector<std::string>{val});
+ return cond;
+ };
+
+ // <cond_str, parsed, expect_value>>
+ std::vector<std::tuple<std::string, bool, TCondition>> test_input {
+ {R"(abc=b)" , true, gen_cond(R"(abc)" , "=" , R"(b)"
)}, // normal case
+ {R"(abc!=b)" , true, gen_cond(R"(abc)" , "!=", R"(b)"
)}, // normal case
+ {R"(abc<=b)" , true, gen_cond(R"(abc)" , "<=", R"(b)"
)}, // normal case
+ {R"(abc>=b)" , true, gen_cond(R"(abc)" , ">=", R"(b)"
)}, // normal case
+ {R"(abc>>b)" , true, gen_cond(R"(abc)" , ">>", R"(b)"
)}, // normal case
+ {R"(abc<<b)" , true, gen_cond(R"(abc)" , "<<", R"(b)"
)}, // normal case
+ {R"(abc!='b')" , true, gen_cond(R"(abc)" , "!=", R"(b)"
)}, // value surrounded by '
+ {R"(abc=)" , true, gen_cond(R"(abc)" , "=" , R"()"
)}, // missing value, it means not to be parsed succefully, how every it's
a ignorable bug
Review Comment:
warning: statement should be inside braces
[readability-braces-around-statements]
```suggestion
cc) << " unexpected result, cond_str: " << cond_str;
unexpected result, co {nd_str: " << cond_str;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]