[Exec](opt) Opt the vexplode_split function performance (#15945)

This commit is contained in:
HappenLee
2023-01-17 19:02:57 +08:00
committed by GitHub
parent 4a261a0403
commit d5a3e8df3a
5 changed files with 74 additions and 22 deletions

View File

@ -179,17 +179,26 @@ TEST_F(TableFunctionTest, vexplode_split) {
// Case 2: explode_split("a,b,c", ",") --> ["a", "b", "c"]
// Case 3: explode_split("a,b,c", "a,")) --> ["", "b,c"]
// Case 4: explode_split("", ",")) --> [""]
InputTypeSet input_types = {TypeIndex::String, TypeIndex::String};
InputDataSet input_set = {{Null(), Null()},
{std::string("a,b,c"), std::string(",")},
{std::string("a,b,c"), std::string("a,")},
{std::string(""), std::string(",")}};
InputTypeSet input_types = {TypeIndex::String, Consted {TypeIndex::String}};
InputDataSet input_sets = {{Null(), Null()},
{std::string("a,b,c"), std::string(",")},
{std::string("a,b,c"), std::string("a,")},
{std::string(""), std::string(",")}};
InputTypeSet output_types = {TypeIndex::String};
InputDataSet output_set = {{std::string("a")}, {std::string("b")}, {std::string("c")},
{std::string("")}, {std::string("b,c")}, {std::string("")}};
InputDataSet output_sets = {{},
{std::string("a"), std::string("b"), std::string("c")},
{std::string(""), std::string("b,c")},
{std::string("")}};
check_vec_table_function(&tfn, input_types, input_set, output_types, output_set);
for (int i = 0; i < input_sets.size(); ++i) {
InputDataSet input_set {input_sets[i]};
InputDataSet output_set {};
for (const auto& data : output_sets[i]) {
output_set.emplace_back(std::vector<AnyType> {data});
}
check_vec_table_function(&tfn, input_types, input_set, output_types, output_set);
}
}
}