Rename yandexConsistentHash to kostikConsistentHash

This commit is contained in:
Alexey Milovidov 2022-03-24 02:18:25 +01:00
parent 4b88c6f934
commit d54138425f
9 changed files with 16 additions and 17 deletions

View File

@ -15,7 +15,7 @@
``` ```
┌─name─────────────────────┬─is_aggregate─┬─case_insensitive─┬─alias_to─┐ ┌─name─────────────────────┬─is_aggregate─┬─case_insensitive─┬─alias_to─┐
│ sumburConsistentHash │ 0 │ 0 │ │ │ sumburConsistentHash │ 0 │ 0 │ │
yandexConsistentHash │ 0 │ 0 │ │ kostikConsistentHash │ 0 │ 0 │ │
│ demangle │ 0 │ 0 │ │ │ demangle │ 0 │ 0 │ │
│ addressToLine │ 0 │ 0 │ │ │ addressToLine │ 0 │ 0 │ │
│ JSONExtractRaw │ 0 │ 0 │ │ │ JSONExtractRaw │ 0 │ 0 │ │

View File

@ -7,9 +7,9 @@ namespace DB
{ {
/// An O(1) time and space consistent hash algorithm by Konstantin Oblakov /// An O(1) time and space consistent hash algorithm by Konstantin Oblakov
struct YandexConsistentHashImpl struct KostikConsistentHashImpl
{ {
static constexpr auto name = "yandexConsistentHash"; static constexpr auto name = "kostikConsistentHash";
using HashType = UInt64; using HashType = UInt64;
/// Actually it supports UInt64, but it is efficient only if n <= 32768 /// Actually it supports UInt64, but it is efficient only if n <= 32768
@ -23,12 +23,11 @@ struct YandexConsistentHashImpl
} }
}; };
using FunctionYandexConsistentHash = FunctionConsistentHashImpl<YandexConsistentHashImpl>; using FunctionKostikConsistentHash = FunctionConsistentHashImpl<KostikConsistentHashImpl>;
void registerFunctionYandexConsistentHash(FunctionFactory & factory) void registerFunctionKostikConsistentHash(FunctionFactory & factory)
{ {
factory.registerFunction<FunctionYandexConsistentHash>(); factory.registerFunction<FunctionKostikConsistentHash>();
} }
} }

View File

@ -2,12 +2,12 @@ namespace DB
{ {
class FunctionFactory; class FunctionFactory;
void registerFunctionYandexConsistentHash(FunctionFactory & factory); void registerFunctionKostikConsistentHash(FunctionFactory & factory);
void registerFunctionJumpConsistentHash(FunctionFactory & factory); void registerFunctionJumpConsistentHash(FunctionFactory & factory);
void registerFunctionsConsistentHashing(FunctionFactory & factory) void registerFunctionsConsistentHashing(FunctionFactory & factory)
{ {
registerFunctionYandexConsistentHash(factory); registerFunctionKostikConsistentHash(factory);
registerFunctionJumpConsistentHash(factory); registerFunctionJumpConsistentHash(factory);
} }

View File

@ -1459,7 +1459,7 @@
"xor" "xor"
"xxHash32" "xxHash32"
"xxHash64" "xxHash64"
"yandexConsistentHash" "kostikConsistentHash"
"YEAR" "YEAR"
"yearweek" "yearweek"
"yesterday" "yesterday"

View File

@ -26,7 +26,7 @@
"toUnixTimestamp64Nano" "toUnixTimestamp64Nano"
"toUnixTimestamp64Micro" "toUnixTimestamp64Micro"
"jumpConsistentHash" "jumpConsistentHash"
"yandexConsistentHash" "kostikConsistentHash"
"addressToSymbol" "addressToSymbol"
"toJSONString" "toJSONString"
"JSON_VALUE" "JSON_VALUE"

View File

@ -67,10 +67,10 @@ def started_cluster():
insert into data (key) select * from numbers(10); insert into data (key) select * from numbers(10);
create table if not exists dist_one as data engine=Distributed(one_shard, currentDatabase(), data, key); create table if not exists dist_one as data engine=Distributed(one_shard, currentDatabase(), data, key);
create table if not exists dist_one_over_dist as data engine=Distributed(one_shard, currentDatabase(), dist_one, yandexConsistentHash(key, 2)); create table if not exists dist_one_over_dist as data engine=Distributed(one_shard, currentDatabase(), dist_one, kostikConsistentHash(key, 2));
create table if not exists dist_two as data engine=Distributed(two_shards, currentDatabase(), data, key); create table if not exists dist_two as data engine=Distributed(two_shards, currentDatabase(), data, key);
create table if not exists dist_two_over_dist as data engine=Distributed(two_shards, currentDatabase(), dist_two, yandexConsistentHash(key, 2)); create table if not exists dist_two_over_dist as data engine=Distributed(two_shards, currentDatabase(), dist_two, kostikConsistentHash(key, 2));
""" """
) )
yield cluster yield cluster

View File

@ -3,7 +3,7 @@
<substitution> <substitution>
<name>hash_func</name> <name>hash_func</name>
<values> <values>
<value>yandexConsistentHash</value> <value>kostikConsistentHash</value>
<value>jumpConsistentHash</value> <value>jumpConsistentHash</value>
</values> </values>
</substitution> </substitution>

View File

@ -1,6 +1,6 @@
-- Tags: no-fasttest -- Tags: no-fasttest
SELECT jumpConsistentHash(1, 1), jumpConsistentHash(42, 57), jumpConsistentHash(256, 1024), jumpConsistentHash(3735883980, 1), jumpConsistentHash(3735883980, 666), jumpConsistentHash(16045690984833335023, 255); SELECT jumpConsistentHash(1, 1), jumpConsistentHash(42, 57), jumpConsistentHash(256, 1024), jumpConsistentHash(3735883980, 1), jumpConsistentHash(3735883980, 666), jumpConsistentHash(16045690984833335023, 255);
SELECT yandexConsistentHash(16045690984833335023, 1), yandexConsistentHash(16045690984833335023, 2), yandexConsistentHash(16045690984833335023, 3), yandexConsistentHash(16045690984833335023, 4), yandexConsistentHash(16045690984833335023, 173), yandexConsistentHash(16045690984833335023, 255); SELECT kostikConsistentHash(16045690984833335023, 1), kostikConsistentHash(16045690984833335023, 2), kostikConsistentHash(16045690984833335023, 3), kostikConsistentHash(16045690984833335023, 4), kostikConsistentHash(16045690984833335023, 173), kostikConsistentHash(16045690984833335023, 255);
SELECT jumpConsistentHash(intHash64(number), 787) FROM system.numbers LIMIT 1000000, 2; SELECT jumpConsistentHash(intHash64(number), 787) FROM system.numbers LIMIT 1000000, 2;
SELECT yandexConsistentHash(16045690984833335023+number-number, 120) FROM system.numbers LIMIT 1000000, 2; SELECT kostikConsistentHash(16045690984833335023+number-number, 120) FROM system.numbers LIMIT 1000000, 2;

View File

@ -1 +1 @@
SELECT yandexConsistentHash(-1, 40000); -- { serverError 36 } SELECT kostikConsistentHash(-1, 40000); -- { serverError 36 }