Skip to content

Commit 5c53ee8

Browse files
Make DateTime UDF overloads backward compatible. (#15776)
1 parent 1df9f70 commit 5c53ee8

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

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

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,13 @@ struct TGetTimeComponent {
262262
}
263263

264264
if (!userType) {
265-
builder.SetError("User type is missing");
265+
// XXX: Function became polymorphic when overload for
266+
// wide resources was implemented. Hence, to make it
267+
// backward compatible with previous versions, the
268+
// absence of the userType is considered as using the
269+
// old version (i.e. without type awareness) that
270+
// provides implementation only for narrow dates.
271+
BuildSignature<TFieldStorage, TMResourceName, Accessor>(builder, typesOnly);
266272
return true;
267273
}
268274

@@ -1099,7 +1105,13 @@ class TGetDateComponent: public ::NYql::NUdf::TBoxedValue {
10991105
}
11001106

11011107
if (!userType) {
1102-
builder.SetError("User type is missing");
1108+
// XXX: Function became polymorphic when overload for
1109+
// wide resources was implemented. Hence, to make it
1110+
// backward compatible with previous versions, the
1111+
// absence of the userType is considered as using the
1112+
// old version (i.e. without type awareness) that
1113+
// provides implementation only for narrow dates.
1114+
BuildSignature<TResultType, TMResourceName, Accessor>(builder, typesOnly);
11031115
return true;
11041116
}
11051117

@@ -1207,7 +1219,13 @@ class TGetDateComponentName: public ::NYql::NUdf::TBoxedValue {
12071219
}
12081220

12091221
if (!userType) {
1210-
builder.SetError("User type is missing");
1222+
// XXX: Function became polymorphic when overload for
1223+
// wide resources was implemented. Hence, to make it
1224+
// backward compatible with previous versions, the
1225+
// absence of the userType is considered as using the
1226+
// old version (i.e. without type awareness) that
1227+
// provides implementation only for narrow dates.
1228+
BuildSignature<TMResourceName, Accessor>(builder, typesOnly);
12111229
return true;
12121230
}
12131231

@@ -1441,7 +1459,13 @@ TUnboxedValue GetTimezoneName(const IValueBuilder* valueBuilder, const TUnboxedV
14411459
}
14421460

14431461
if (!userType) {
1444-
builder.SetError("User type is missing");
1462+
// XXX: Function became polymorphic when overload for
1463+
// wide resources was implemented. Hence, to make it
1464+
// backward compatible with previous versions, the
1465+
// absence of the userType is considered as using the
1466+
// old version (i.e. without type awareness) that
1467+
// provides implementation only for narrow dates.
1468+
BuildSignature<TMResourceName>(builder, typesOnly);
14451469
return true;
14461470
}
14471471

@@ -1737,7 +1761,13 @@ class TBoundaryOf: public ::NYql::NUdf::TBoxedValue {
17371761
}
17381762

17391763
if (!userType) {
1740-
builder.SetError("User type is missing");
1764+
// XXX: Function became polymorphic when overload for
1765+
// wide resources was implemented. Hence, to make it
1766+
// backward compatible with previous versions, the
1767+
// absence of the userType is considered as using the
1768+
// old version (i.e. without type awareness) that
1769+
// provides implementation only for narrow dates.
1770+
BuildSignature<TMResourceName, Boundary>(builder, typesOnly);
17411771
return true;
17421772
}
17431773

@@ -2112,7 +2142,13 @@ class TShift : public TBoxedValue {
21122142
}
21132143

21142144
if (!userType) {
2115-
builder.SetError("User type is missing");
2145+
// XXX: Function became polymorphic when overload for
2146+
// wide resources was implemented. Hence, to make it
2147+
// backward compatible with previous versions, the
2148+
// absence of the userType is considered as using the
2149+
// old version (i.e. without type awareness) that
2150+
// provides implementation only for narrow dates.
2151+
BuildSignature<TMResourceName, Shifter>(builder, typesOnly);
21162152
return true;
21172153
}
21182154

0 commit comments

Comments
 (0)