Skip to content

Commit 8f60223

Browse files
authored
Make Digest UDF backward compatible for incremental upgrade (#18873)
2 parents d0bb904 + fcb5799 commit 8f60223

File tree

7 files changed

+11
-231
lines changed

7 files changed

+11
-231
lines changed

yql/essentials/udfs/common/digest/digest_udf.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include <yql/essentials/public/udf/udf_helpers.h>
22
#include <yql/essentials/public/udf/udf_value_builder.h>
33

4+
#include <yql/essentials/minikql/mkql_runtime_version.h>
5+
46
#include <util/digest/murmur.h>
57
#include <util/digest/city.h>
68
#include <util/digest/numeric.h>
@@ -56,6 +58,15 @@ namespace {
5658
return false;
5759
}
5860

61+
// FIXME: The condition below is required to untie the
62+
// Gordian knot with the upgrade, when two MiniKQL
63+
// runtimes with different versions are being used.
64+
// See YQL-19967 for more info.
65+
if (MKQL_RUNTIME_VERSION < 51U && typesOnly) {
66+
builder.SimpleSignature<TResult(TAutoMap<char*>)>();
67+
return true;
68+
}
69+
5970
auto args = builder.Args();
6071
args->Add(builder.SimpleType<char *>()).Flags(ICallablePayload::TArgumentFlags::AutoMap);
6172
args->Add(builder.Optional()->Item(builder.SimpleType<TResult>()).Build()).Name("Init");

yql/essentials/udfs/common/digest/test/canondata/result.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,5 @@
33
{
44
"uri": "file://test.test_Basic_/results.txt"
55
}
6-
],
7-
"test.test[Init]": [
8-
{
9-
"uri": "file://test.test_Init_/results.txt"
10-
}
116
]
127
}

yql/essentials/udfs/common/digest/test/canondata/test.test_Basic_/results.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@
7070
"Uint64"
7171
]
7272
];
73-
[
74-
"cityWithSeed";
75-
[
76-
"DataType";
77-
"Uint64"
78-
]
79-
];
8073
[
8174
"city128";
8275
[
@@ -275,7 +268,6 @@
275268
"5654386555365545660";
276269
"1466639702";
277270
"11413460447292444913";
278-
"684814019408231284";
279271
[
280272
"125830901799957853";
281273
"7569582475522398857"
@@ -334,7 +326,6 @@
334326
"16472888669357673283";
335327
"2351653828";
336328
"17472595041006102391";
337-
"8016373356242392939";
338329
[
339330
"13426016195983081906";
340331
"17051066397148972982"
@@ -393,7 +384,6 @@
393384
"6734453432295282525";
394385
"2128480519";
395386
"11275350073939794026";
396-
"1669883546352889947";
397387
[
398388
"15168680716710346397";
399389
"13490672353767795293"
@@ -452,7 +442,6 @@
452442
"0";
453443
"0";
454444
"11160318154034397263";
455-
"12607432989128692740";
456445
[
457446
"18085479540095642321";
458447
"11079402499652051579"

yql/essentials/udfs/common/digest/test/canondata/test.test_Init_/results.txt

Lines changed: 0 additions & 202 deletions
This file was deleted.

yql/essentials/udfs/common/digest/test/cases/Basic.sql

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

yql/essentials/udfs/common/digest/test/cases/Init.cfg

Lines changed: 0 additions & 1 deletion
This file was deleted.

yql/essentials/udfs/common/digest/test/cases/Init.sql

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)