Skip to content

Commit 36da963

Browse files
committed
Tweak signatures for extended datetime types overloads
1 parent 70deecf commit 36da963

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

yql/essentials/udfs/common/datetime2/datetime_udf.cpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,18 @@ struct TGetTimeComponent {
316316

317317
const auto features = NUdf::GetDataTypeInfo(NUdf::GetDataSlot(data.GetTypeId())).Features;
318318
if (features & NUdf::BigDateType) {
319+
// FIXME: The condition below is required to untie the
320+
// Gordian knot with the upgrade, when two MiniKQL
321+
// runtimes with different versions are being used.
322+
// See YQL-19967 for more info.
323+
if (MKQL_RUNTIME_VERSION < 51U && typesOnly) {
324+
::TStringBuilder sb;
325+
sb << "Invalid argument type: got ";
326+
TTypePrinter(*typeInfoHelper, argType).Out(sb.Out);
327+
sb << ", but Resource<" << TMResourceName << "> expected";
328+
builder.SetError(sb);
329+
return true;
330+
}
319331
BuildSignature<TFieldStorage, TM64ResourceName, WAccessor>(builder, typesOnly);
320332
return true;
321333
}
@@ -1158,6 +1170,18 @@ class TGetDateComponent: public ::NYql::NUdf::TBoxedValue {
11581170

11591171
const auto features = NUdf::GetDataTypeInfo(NUdf::GetDataSlot(data.GetTypeId())).Features;
11601172
if (features & NUdf::BigDateType) {
1173+
// FIXME: The condition below is required to untie the
1174+
// Gordian knot with the upgrade, when two MiniKQL
1175+
// runtimes with different versions are being used.
1176+
// See YQL-19967 for more info.
1177+
if (MKQL_RUNTIME_VERSION < 51U && typesOnly) {
1178+
::TStringBuilder sb;
1179+
sb << "Invalid argument type: got ";
1180+
TTypePrinter(*typeInfoHelper, argType).Out(sb.Out);
1181+
sb << ", but Resource<" << TMResourceName << "> expected";
1182+
builder.SetError(sb);
1183+
return true;
1184+
}
11611185
BuildSignature<TResultWType, TM64ResourceName, WAccessor>(builder, typesOnly);
11621186
return true;
11631187
}
@@ -1282,6 +1306,18 @@ class TGetDateComponentName: public ::NYql::NUdf::TBoxedValue {
12821306

12831307
const auto features = NUdf::GetDataTypeInfo(NUdf::GetDataSlot(data.GetTypeId())).Features;
12841308
if (features & NUdf::BigDateType) {
1309+
// FIXME: The condition below is required to untie the
1310+
// Gordian knot with the upgrade, when two MiniKQL
1311+
// runtimes with different versions are being used.
1312+
// See YQL-19967 for more info.
1313+
if (MKQL_RUNTIME_VERSION < 51U && typesOnly) {
1314+
::TStringBuilder sb;
1315+
sb << "Invalid argument type: got ";
1316+
TTypePrinter(*typeInfoHelper, argType).Out(sb.Out);
1317+
sb << ", but Resource<" << TMResourceName << "> expected";
1318+
builder.SetError(sb);
1319+
return true;
1320+
}
12851321
BuildSignature<TM64ResourceName, WAccessor>(builder, typesOnly);
12861322
return true;
12871323
}
@@ -1532,6 +1568,18 @@ TUnboxedValue GetTimezoneName(const IValueBuilder* valueBuilder, const TUnboxedV
15321568

15331569
const auto features = NUdf::GetDataTypeInfo(NUdf::GetDataSlot(data.GetTypeId())).Features;
15341570
if (features & NUdf::BigDateType) {
1571+
// FIXME: The condition below is required to untie the
1572+
// Gordian knot with the upgrade, when two MiniKQL
1573+
// runtimes with different versions are being used.
1574+
// See YQL-19967 for more info.
1575+
if (MKQL_RUNTIME_VERSION < 51U && typesOnly) {
1576+
::TStringBuilder sb;
1577+
sb << "Invalid argument type: got ";
1578+
TTypePrinter(*typeInfoHelper, argType).Out(sb.Out);
1579+
sb << ", but Resource<" << TMResourceName << "> expected";
1580+
builder.SetError(sb);
1581+
return true;
1582+
}
15351583
BuildSignature<TM64ResourceName>(builder, typesOnly);
15361584
return true;
15371585
}
@@ -1844,6 +1892,18 @@ class TBoundaryOf: public ::NYql::NUdf::TBoxedValue {
18441892

18451893
const auto features = NUdf::GetDataTypeInfo(NUdf::GetDataSlot(data.GetTypeId())).Features;
18461894
if (features & NUdf::BigDateType) {
1895+
// FIXME: The condition below is required to untie the
1896+
// Gordian knot with the upgrade, when two MiniKQL
1897+
// runtimes with different versions are being used.
1898+
// See YQL-19967 for more info.
1899+
if (MKQL_RUNTIME_VERSION < 51U && typesOnly) {
1900+
::TStringBuilder sb;
1901+
sb << "Invalid argument type: got ";
1902+
TTypePrinter(*typeInfoHelper, argType).Out(sb.Out);
1903+
sb << ", but Resource<" << TMResourceName << "> expected";
1904+
builder.SetError(sb);
1905+
return true;
1906+
}
18471907
BuildSignature<TM64ResourceName, WBoundary>(builder, typesOnly);
18481908
return true;
18491909
}
@@ -2235,6 +2295,18 @@ class TShift : public TBoxedValue {
22352295

22362296
const auto features = NUdf::GetDataTypeInfo(NUdf::GetDataSlot(data.GetTypeId())).Features;
22372297
if (features & NUdf::BigDateType) {
2298+
// FIXME: The condition below is required to untie the
2299+
// Gordian knot with the upgrade, when two MiniKQL
2300+
// runtimes with different versions are being used.
2301+
// See YQL-19967 for more info.
2302+
if (MKQL_RUNTIME_VERSION < 51U && typesOnly) {
2303+
::TStringBuilder sb;
2304+
sb << "Invalid argument type: got ";
2305+
TTypePrinter(*typeInfoHelper, argType).Out(sb.Out);
2306+
sb << ", but Resource<" << TMResourceName << "> expected";
2307+
builder.SetError(sb);
2308+
return true;
2309+
}
22382310
BuildSignature<TM64ResourceName, WShifter>(builder, typesOnly);
22392311
return true;
22402312
}

0 commit comments

Comments
 (0)