patch 4.0
This commit is contained in:
@ -15,18 +15,20 @@
|
||||
#include "observer/ob_req_time_service.h"
|
||||
#include "test_optimizer_utils.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
class Path;
|
||||
}
|
||||
} // namespace oceanbase
|
||||
namespace test {
|
||||
class TestJoinOrder : public TestOptimizerUtils {
|
||||
}
|
||||
namespace test
|
||||
{
|
||||
class TestJoinOrder: public TestOptimizerUtils
|
||||
{
|
||||
public:
|
||||
TestJoinOrder()
|
||||
{}
|
||||
~TestJoinOrder()
|
||||
{}
|
||||
TestJoinOrder(){}
|
||||
~TestJoinOrder(){}
|
||||
};
|
||||
|
||||
TEST_F(TestJoinOrder, ob_join_order_select)
|
||||
@ -37,15 +39,14 @@ TEST_F(TestJoinOrder, ob_join_order_select)
|
||||
run_test(test_file, result_file, tmp_file);
|
||||
}
|
||||
|
||||
class TestPath : public oceanbase::sql::Path {
|
||||
virtual void get_name_internal(char* buf, const int64_t buf_len, int64_t& pos) const
|
||||
{
|
||||
UNUSED(buf), UNUSED(buf_len), UNUSED(pos);
|
||||
}
|
||||
virtual int estimate_cost() override
|
||||
{
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
class TestPath : public oceanbase::sql::Path
|
||||
{
|
||||
virtual void get_name_internal(char *buf, const int64_t buf_len, int64_t &pos) const
|
||||
{ UNUSED(buf), UNUSED(buf_len), UNUSED(pos);}
|
||||
virtual int estimate_cost() override { return OB_SUCCESS; }
|
||||
virtual int re_estimate_cost(double need_row_count, double &cost) { UNUSED(need_row_count); cost = 0; return OB_SUCCESS; }
|
||||
virtual int contain_fake_cte(bool &contains) const { contains = false; return OB_SUCCESS; }
|
||||
|
||||
};
|
||||
|
||||
TEST_F(TestJoinOrder, ob_join_order_src)
|
||||
@ -68,31 +69,19 @@ TEST_F(TestJoinOrder, ob_join_order_src)
|
||||
SubQueryPath sp_path;
|
||||
memset(buf, '\0', 256);
|
||||
sp_path.get_name_internal(buf, 256, pos);
|
||||
ObQueryHint hint;
|
||||
ObGlobalHint global_hint;
|
||||
ObAddr addr;
|
||||
ObRawExprFactory expr_factory(allocator);
|
||||
ObOptimizerContext ctx(NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
allocator,
|
||||
NULL,
|
||||
NULL,
|
||||
addr,
|
||||
NULL,
|
||||
OB_MERGED_VERSION_INIT,
|
||||
hint,
|
||||
expr_factory,
|
||||
NULL);
|
||||
ObOptimizerContext ctx(NULL, NULL, NULL, NULL, NULL,
|
||||
allocator, NULL, NULL, addr, NULL,
|
||||
global_hint, expr_factory, NULL, false, NULL);
|
||||
ObSelectLogPlan plan(ctx, NULL);
|
||||
ObJoinOrder join_order(NULL, &plan, INVALID);
|
||||
ObJoinOrder join_order(NULL, &plan, sql::INVALID);
|
||||
|
||||
TestPath test_path;
|
||||
LOG_INFO("test to string func", K(test_path), K(join_order));
|
||||
pos = join_order.get_name(buf, 256);
|
||||
// case: test reset()
|
||||
//case: test reset()
|
||||
ret = join_order.interesting_paths_.push_back(&sp_path);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
join_order.join_info_ = &out_join;
|
||||
@ -101,16 +90,19 @@ TEST_F(TestJoinOrder, ob_join_order_src)
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
}
|
||||
|
||||
} // end of namespace test
|
||||
int main(int argc, char** argv)
|
||||
}//end of namespace test
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
OB_LOGGER.set_file_name("test_join_order.log", true);
|
||||
observer::ObReqTimeGuard req_timeinfo_guard;
|
||||
init_sql_factories();
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
if (argc >= 2) {
|
||||
if (strcmp("DEBUG", argv[1]) == 0 || strcmp("INFO", argv[1]) == 0 || strcmp("WARN", argv[1]) == 0)
|
||||
OB_LOGGER.set_log_level(argv[1]);
|
||||
::testing::InitGoogleTest(&argc,argv);
|
||||
if(argc >= 2)
|
||||
{
|
||||
if (strcmp("DEBUG", argv[1]) == 0
|
||||
|| strcmp("INFO", argv[1]) == 0
|
||||
|| strcmp("WARN", argv[1]) == 0)
|
||||
OB_LOGGER.set_log_level(argv[1]);
|
||||
}
|
||||
test::parse_cmd_line_param(argc, argv, test::clp);
|
||||
return RUN_ALL_TESTS();
|
||||
|
||||
Reference in New Issue
Block a user