Skip to content

Commit 7613380

Browse files
authored
Merge 7ae76a2 into 7873f89
2 parents 7873f89 + 7ae76a2 commit 7613380

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

ydb/library/yql/udfs/common/digest/digest_udf.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ namespace {
8989
return TUnboxedValuePod(hash);
9090
}
9191

92+
SIMPLE_STRICT_UDF(TCityHashWithSeed, ui64(TAutoMap<char*>, ui64)) {
93+
Y_UNUSED(valueBuilder);
94+
const auto& inputRef = args[0].AsStringRef();
95+
ui64 seed = args[1].Get<ui64>();
96+
ui64 hash = CityHash64WithSeed(inputRef.Data(), inputRef.Size(), seed);
97+
return TUnboxedValuePod(hash);
98+
}
99+
92100
using TUi64Pair = NUdf::TTuple<ui64, ui64>;
93101

94102
class TCityHash128: public TBoxedValue {
@@ -378,6 +386,7 @@ namespace {
378386
TMurMurHash2A,
379387
TMurMurHash2A32,
380388
TCityHash,
389+
TCityHashWithSeed,
381390
TCityHash128,
382391
TNumericHash,
383392
TMd5Hex,

ydb/library/yql/udfs/common/digest/test/canondata/test.test_Basic_/results.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@
7070
"Uint64"
7171
]
7272
];
73+
[
74+
"cityWithSeed";
75+
[
76+
"DataType";
77+
"Uint64"
78+
]
79+
];
7380
[
7481
"city128";
7582
[
@@ -268,6 +275,7 @@
268275
"5654386555365545660";
269276
"1466639702";
270277
"11413460447292444913";
278+
"684814019408231284";
271279
[
272280
"125830901799957853";
273281
"7569582475522398857"
@@ -326,6 +334,7 @@
326334
"16472888669357673283";
327335
"2351653828";
328336
"17472595041006102391";
337+
"8016373356242392939";
329338
[
330339
"13426016195983081906";
331340
"17051066397148972982"
@@ -384,6 +393,7 @@
384393
"6734453432295282525";
385394
"2128480519";
386395
"11275350073939794026";
396+
"1669883546352889947";
387397
[
388398
"15168680716710346397";
389399
"13490672353767795293"
@@ -442,6 +452,7 @@
442452
"0";
443453
"0";
444454
"11160318154034397263";
455+
"12607432989128692740";
445456
[
446457
"18085479540095642321";
447458
"11079402499652051579"

ydb/library/yql/udfs/common/digest/test/cases/Basic.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ SELECT
99
Digest::MurMurHash2A(key) AS murmur2a,
1010
Digest::MurMurHash2A32(key) AS murmur2a32,
1111
Digest::CityHash(key) AS city,
12+
Digest::CityHashWithSeed(key, 111) AS cityWithSeed,
1213
Digest::CityHash128(key) AS city128,
1314
Digest::NumericHash(COALESCE(CAST(key AS Uint64), 0)) AS numeric,
1415
Digest::Md5Hex(key) AS md5hex,

0 commit comments

Comments
 (0)