patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -24,11 +24,13 @@
#undef private
namespace oceanbase {
namespace share {
namespace oceanbase
{
namespace share
{
using namespace common;
using namespace sql;
static bool is_equal_content(const char* tmp_file, const char* result_file)
static bool is_equal_content(const char *tmp_file, const char *result_file)
{
std::ifstream if_tmp(tmp_file);
std::ifstream if_result(result_file);
@ -42,17 +44,13 @@ static bool is_equal_content(const char* tmp_file, const char* result_file)
return std::equal(if_tmp_iter, std::istream_iterator<std::string>(), if_result_iter);
}
class ObTestDatumCmp : public ::testing::Test {
class ObTestDatumCmp: public ::testing::Test
{
public:
ObTestDatumCmp()
{}
~ObTestDatumCmp()
{}
virtual void SetUp()
{}
virtual void TearDown()
{}
ObTestDatumCmp() {}
~ObTestDatumCmp() {}
virtual void SetUp() {}
virtual void TearDown() {}
private:
DISALLOW_COPY_AND_ASSIGN(ObTestDatumCmp);
};
@ -64,22 +62,27 @@ TEST(ObTestDatumCmp, defined_nullsafe_func_by_type)
std::ofstream of_result(tmp_file);
for (int i = 0; i < ObMaxType; i++) {
of_result << "/**************** " << ob_obj_type_str(static_cast<ObObjType>(i)) << " ****************/"
<< "\n\n";
of_result << "/**************** " << ob_obj_type_str(static_cast<ObObjType>(i))
<< " ****************/" << "\n\n";
for (int j = 0; j < ObMaxType; j++) {
of_result << "<" << ob_obj_type_str(static_cast<ObObjType>(i)) << ", "
<< ob_obj_type_str(static_cast<ObObjType>(j)) << ">"
of_result << "<"
<< ob_obj_type_str(static_cast<ObObjType>(i))
<< ", "
<< ob_obj_type_str(static_cast<ObObjType>(j))
<< ">"
<< " : ";
if (NULL !=
ObDatumFuncs::get_nullsafe_cmp_func(
static_cast<ObObjType>(i), static_cast<ObObjType>(j), NULL_FIRST, CS_TYPE_COLLATION_FREE, false)) {
if (NULL != ObDatumFuncs::get_nullsafe_cmp_func(static_cast<ObObjType>(i),
static_cast<ObObjType>(j),
NULL_FIRST,
CS_TYPE_COLLATION_FREE,
false)) {
of_result << "defined\n";
} else {
of_result << "not defined\n";
}
} // for end
} // for end
of_result << "\n";
} // for end
} // for end
of_result.flush();
EXPECT_TRUE(is_equal_content(tmp_file, defined_func_file));
}
@ -91,27 +94,32 @@ TEST(ObTestDatumCmp, defined_expr_func_by_type)
std::ofstream of_result(tmp_file);
for (int i = 0; i < ObMaxType; i++) {
of_result << "/**************** " << ob_obj_type_str(static_cast<ObObjType>(i)) << " ****************/"
<< "\n\n";
of_result << "/**************** " << ob_obj_type_str(static_cast<ObObjType>(i))
<< " ****************/" << "\n\n";
for (int j = 0; j < ObMaxType; j++) {
of_result << "<" << ob_obj_type_str(static_cast<ObObjType>(i)) << ", "
<< ob_obj_type_str(static_cast<ObObjType>(j)) << "> : ";
if (NULL != ObExprCmpFuncsHelper::get_datum_expr_cmp_func(
static_cast<ObObjType>(i), static_cast<ObObjType>(j), false, CS_TYPE_COLLATION_FREE)) {
of_result << "<"
<< ob_obj_type_str(static_cast<ObObjType>(i))
<< ", "
<< ob_obj_type_str(static_cast<ObObjType>(j))
<< "> : ";
if (NULL != ObExprCmpFuncsHelper::get_datum_expr_cmp_func(static_cast<ObObjType>(i),
static_cast<ObObjType>(j),
false,
CS_TYPE_COLLATION_FREE)) {
of_result << "defined\n";
} else {
of_result << "not defined\n";
}
} // for end
} // for end
of_result << "\n";
} // for end
} // for end
of_result.flush();
EXPECT_TRUE(is_equal_content(tmp_file, defined_func_file));
}
} // end namespace share
} // end namespace oceanbase
} // end namespace share
} // end namespace oceanbase
int main(int argc, char** argv)
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
OB_LOGGER.set_log_level("INFO");