[Function](ELT)Add elt function (#12321)

This commit is contained in:
yongjinhou
2022-09-07 15:21:08 +08:00
committed by GitHub
parent f2923f9180
commit 09b45f2b71
11 changed files with 256 additions and 0 deletions

View File

@ -343,6 +343,50 @@ TEST(function_string_test, function_concat_test) {
};
}
TEST(function_string_test, function_elt_test) {
std::string func_name = "elt";
{
InputTypeSet input_types = {TypeIndex::Int32, TypeIndex::String, TypeIndex::String};
DataSet data_set = {{{1, std::string("hello"), std::string("world")}, std::string("hello")},
{{1, std::string("你好"), std::string("百度")}, std::string("你好")},
{{1, std::string("hello"), std::string("")}, std::string("hello")}};
check_function<DataTypeString, true>(func_name, input_types, data_set);
};
{
InputTypeSet input_types = {TypeIndex::Int32, TypeIndex::String, TypeIndex::String};
DataSet data_set = {{{2, std::string("hello"), std::string("world")}, std::string("world")},
{{2, std::string("你好"), std::string("百度")}, std::string("百度")},
{{2, std::string("hello"), std::string("")}, std::string("")}};
check_function<DataTypeString, true>(func_name, input_types, data_set);
};
{
InputTypeSet input_types = {TypeIndex::Int32, TypeIndex::String, TypeIndex::String};
DataSet data_set = {{{0, std::string("hello"), std::string("world")}, Null()},
{{0, std::string("你好"), std::string("百度")}, Null()},
{{0, std::string("hello"), std::string("")}, Null()}};
check_function<DataTypeString, true>(func_name, input_types, data_set);
};
{
InputTypeSet input_types = {TypeIndex::Int32, TypeIndex::String, TypeIndex::String};
DataSet data_set = {{{3, std::string("hello"), std::string("world")}, Null()},
{{3, std::string("你好"), std::string("百度")}, Null()},
{{3, std::string("hello"), std::string("")}, Null()}};
check_function<DataTypeString, true>(func_name, input_types, data_set);
};
}
TEST(function_string_test, function_concat_ws_test) {
std::string func_name = "concat_ws";
{