[Feature](function) Support xxhash function like murmur hash function (#31193)

This commit is contained in:
yangshijie
2024-02-23 11:07:50 +08:00
committed by yiguolei
parent 1456785aa1
commit 8f77e6363a
21 changed files with 690 additions and 66 deletions

View File

@ -94,4 +94,68 @@ TEST(HashFunctionTest, murmur_hash_3_64_test) {
};
}
TEST(HashFunctionTest, xxhash_32_test) {
std::string func_name = "xxhash_32";
{
InputTypeSet input_types = {TypeIndex::String};
DataSet data_set = {{{Null()}, Null()}, {{std::string("hello")}, (int32_t)-83855367}};
static_cast<void>(check_function<DataTypeInt32, true>(func_name, input_types, data_set));
};
{
InputTypeSet input_types = {TypeIndex::String, TypeIndex::String};
DataSet data_set = {{{std::string("hello"), std::string("world")}, (int32_t)-920844969},
{{std::string("hello"), Null()}, Null()}};
static_cast<void>(check_function<DataTypeInt32, true>(func_name, input_types, data_set));
};
{
InputTypeSet input_types = {TypeIndex::String, TypeIndex::String, TypeIndex::String};
DataSet data_set = {{{std::string("hello"), std::string("world"), std::string("!")},
(int32_t)352087701},
{{std::string("hello"), std::string("world"), Null()}, Null()}};
static_cast<void>(check_function<DataTypeInt32, true>(func_name, input_types, data_set));
};
}
TEST(HashFunctionTest, xxhash_64_test) {
std::string func_name = "xxhash_64";
{
InputTypeSet input_types = {TypeIndex::String};
DataSet data_set = {{{Null()}, Null()},
{{std::string("hello")}, (int64_t)-7685981735718036227}};
static_cast<void>(check_function<DataTypeInt64, true>(func_name, input_types, data_set));
};
{
InputTypeSet input_types = {TypeIndex::String, TypeIndex::String};
DataSet data_set = {
{{std::string("hello"), std::string("world")}, (int64_t)7001965798170371843},
{{std::string("hello"), Null()}, Null()}};
static_cast<void>(check_function<DataTypeInt64, true>(func_name, input_types, data_set));
};
{
InputTypeSet input_types = {TypeIndex::String, TypeIndex::String, TypeIndex::String};
DataSet data_set = {{{std::string("hello"), std::string("world"), std::string("!")},
(int64_t)6796829678999971400},
{{std::string("hello"), std::string("world"), Null()}, Null()}};
static_cast<void>(check_function<DataTypeInt64, true>(func_name, input_types, data_set));
};
}
} // namespace doris::vectorized