Skip to content

Commit 55fa508

Browse files
committed
Tweak signatures for extended datetime types overloads
1 parent c77fe32 commit 55fa508

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,18 @@ class TToUnits {
269269
builder.Args()->Add(argsTuple.GetElementType(0));
270270
const TType* retType;
271271
if (features & NUdf::ExtDateType) {
272+
// FIXME: The condition below is required to untie the
273+
// Gordian knot with the upgrade, when two MiniKQL
274+
// runtimes with different versions are being used.
275+
// See YQL-19967 for more info.
276+
if (MKQL_RUNTIME_VERSION < 51U && typesOnly) {
277+
::TStringBuilder sb;
278+
sb << "Invalid argument type: got ";
279+
TTypePrinter(*typeInfoHelper, argType).Out(sb.Out);
280+
sb << ", but one of Date/Datetime/Timestamp/TzDate/TzDatetime/TzTimestamp/Interval expected";
281+
builder.SetError(sb);
282+
return true;
283+
}
272284
retType = builder.SimpleType<TWResult>();
273285
} else if (features & NUdf::TimeIntervalType) {
274286
retType = builder.SimpleType<TSignedResult>();
@@ -2023,6 +2035,18 @@ class TToConverter : public TBoxedValue {
20232035
const auto features = NUdf::GetDataTypeInfo(NUdf::GetDataSlot(data.GetTypeId())).Features;
20242036
if (features & NUdf::TimeIntervalType) {
20252037
if (features & NUdf::ExtDateType) {
2038+
// FIXME: The condition below is required to untie the
2039+
// Gordian knot with the upgrade, when two MiniKQL
2040+
// runtimes with different versions are being used.
2041+
// See YQL-19967 for more info.
2042+
if (MKQL_RUNTIME_VERSION < 51U && typesOnly) {
2043+
::TStringBuilder sb;
2044+
sb << "Invalid argument type: got ";
2045+
TTypePrinter(*typeInfoHelper, argType).Out(sb.Out);
2046+
sb << ", but Interval expected";
2047+
builder.SetError(sb);
2048+
return true;
2049+
}
20262050
BuildSignature<TInterval64, TWResult>(builder, typesOnly);
20272051
} else {
20282052
BuildSignature<TInterval, TResult>(builder, typesOnly);
@@ -2498,6 +2522,18 @@ class TBoundaryOfInterval: public ::NYql::NUdf::TBoxedValue {
24982522

24992523
const auto features = NUdf::GetDataTypeInfo(NUdf::GetDataSlot(data.GetTypeId())).Features;
25002524
if (features & NUdf::ExtDateType) {
2525+
// FIXME: The condition below is required to untie the
2526+
// Gordian knot with the upgrade, when two MiniKQL
2527+
// runtimes with different versions are being used.
2528+
// See YQL-19967 for more info.
2529+
if (MKQL_RUNTIME_VERSION < 51U && typesOnly) {
2530+
::TStringBuilder sb;
2531+
sb << "Invalid argument type: got ";
2532+
TTypePrinter(*typeInfoHelper, argType).Out(sb.Out);
2533+
sb << ", but Resource<" << TMResourceName << "> expected";
2534+
builder.SetError(sb);
2535+
return true;
2536+
}
25012537
BuildSignature<TM64ResourceName, WBoundary>(builder, typesOnly);
25022538
return true;
25032539
}
@@ -2620,6 +2656,18 @@ class TTimeOfDay: public ::NYql::NUdf::TBoxedValue {
26202656

26212657
const auto features = NUdf::GetDataTypeInfo(NUdf::GetDataSlot(data.GetTypeId())).Features;
26222658
if (features & NUdf::ExtDateType) {
2659+
// FIXME: The condition below is required to untie the
2660+
// Gordian knot with the upgrade, when two MiniKQL
2661+
// runtimes with different versions are being used.
2662+
// See YQL-19967 for more info.
2663+
if (MKQL_RUNTIME_VERSION < 51U && typesOnly) {
2664+
::TStringBuilder sb;
2665+
sb << "Invalid argument type: got ";
2666+
TTypePrinter(*typeInfoHelper, argType).Out(sb.Out);
2667+
sb << ", but Resource<" << TMResourceName << "> expected";
2668+
builder.SetError(sb);
2669+
return true;
2670+
}
26232671
BuildSignature<TM64ResourceName>(builder, typesOnly);
26242672
return true;
26252673
}

0 commit comments

Comments
 (0)