patch 4.0
This commit is contained in:
@ -26,45 +26,50 @@
|
||||
using namespace oceanbase::common;
|
||||
using namespace oceanbase::sql;
|
||||
|
||||
class TestExprGenerator : public ::testing::Test {
|
||||
class TestExprGenerator: public ::testing::Test
|
||||
{
|
||||
public:
|
||||
TestExprGenerator();
|
||||
virtual ~TestExprGenerator();
|
||||
virtual void SetUp();
|
||||
virtual void TearDown();
|
||||
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(TestExprGenerator);
|
||||
|
||||
protected:
|
||||
// function members
|
||||
void generate_expr(const char* expr_str, const char*& post_expr);
|
||||
|
||||
void generate_expr(const char *expr_str,
|
||||
const char* &post_expr);
|
||||
protected:
|
||||
// data members
|
||||
ObPhysicalPlan phy_plan_;
|
||||
};
|
||||
|
||||
TestExprGenerator::TestExprGenerator()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
TestExprGenerator::~TestExprGenerator()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void TestExprGenerator::SetUp()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void TestExprGenerator::TearDown()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void TestExprGenerator::generate_expr(const char* expr_str, const char*& post_expr)
|
||||
void TestExprGenerator::generate_expr(const char *expr_str,
|
||||
const char* &post_expr)
|
||||
{
|
||||
ObArray<ObQualifiedName> columns;
|
||||
ObArray<ObVarInfo> sys_vars;
|
||||
ObArray<ObSubQueryInfo> sub_query_info;
|
||||
ObArray<ObAggFunRawExpr*> aggr_exprs;
|
||||
ObArray<ObWinFunRawExpr*> win_exprs;
|
||||
ObArray<ObUDFInfo> udf_info;
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObRawExprFactory expr_factory(allocator);
|
||||
ObTimeZoneInfo tz_info;
|
||||
@ -72,15 +77,15 @@ void TestExprGenerator::generate_expr(const char* expr_str, const char*& post_ex
|
||||
ObExprResolveContext ctx(expr_factory, &tz_info, case_mode);
|
||||
ctx.connection_charset_ = ObCharset::get_default_charset();
|
||||
ctx.dest_collation_ = ObCharset::get_default_collation(ctx.connection_charset_);
|
||||
ObRawExpr* expr = NULL;
|
||||
OK(ObRawExprUtils::make_raw_expr_from_str(
|
||||
expr_str, strlen(expr_str), ctx, expr, columns, sys_vars, &sub_query_info, aggr_exprs, win_exprs));
|
||||
ObRawExpr *expr = NULL;
|
||||
OK(ObRawExprUtils::make_raw_expr_from_str(expr_str, strlen(expr_str), ctx, expr, columns,
|
||||
sys_vars, &sub_query_info, aggr_exprs, win_exprs, udf_info));
|
||||
RowDesc row_desc;
|
||||
OK(row_desc.init());
|
||||
for (int64_t i = 0; i < columns.count(); ++i) {
|
||||
OK(row_desc.add_column(columns[i].ref_expr_));
|
||||
}
|
||||
ObSqlExpression* sql_expr = NULL;
|
||||
ObSqlExpression *sql_expr = NULL;
|
||||
ObColumnExpression col_expr(allocator);
|
||||
ObAggregateExpression aggr_expr(allocator);
|
||||
if (expr->is_aggr_expr()) {
|
||||
@ -94,6 +99,8 @@ void TestExprGenerator::generate_expr(const char* expr_str, const char*& post_ex
|
||||
post_expr = CSJ(sql_expr);
|
||||
}
|
||||
|
||||
//由于实现enum和set后对cg进行了更改,依赖expr调用deduce_type。
|
||||
//而该测试用无法成功调用deduce type,因为无法获得column 的type,因此暂时注销掉该case
|
||||
TEST_F(TestExprGenerator, DISABLED_basic_test)
|
||||
{
|
||||
const char* test_file = "test_expr_generator.test";
|
||||
@ -123,13 +130,13 @@ TEST_F(TestExprGenerator, DISABLED_basic_test)
|
||||
std::remove("./test_resolver.tmp");
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
system("rm -rf test_expr_generator.log");
|
||||
OB_LOGGER.set_log_level("INFO");
|
||||
OB_LOGGER.set_file_name("test_expr_generator.log", true);
|
||||
|
||||
::oceanbase::sql::init_sql_factories();
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
::testing::InitGoogleTest(&argc,argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
Reference in New Issue
Block a user