github-actions[bot] commented on code in PR #32404: URL: https://github.com/apache/doris/pull/32404#discussion_r1528463207
########## be/test/olap/delete_handler_test.cpp: ########## @@ -1232,4 +1232,43 @@ TEST_F(TestDeleteHandler, FilterDataVersion) { _delete_handler.finalize(); } +// 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_delete_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"(@a*<<10086)" , true, gen_cond(R"(@a*)" , "<<", R"(10086)" )}, // column ends with * Review Comment: warning: statement should be inside braces [readability-braces-around-statements] ```suggestion exp_succ) { EXPECT_EQ(parsed_cond, exp_cond) << " unexpected result, cond_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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org