@@ -1003,8 +1003,13 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideCombinerPerfTest) {
1003
1003
#endif
1004
1004
#if !defined(MKQL_RUNTIME_VERSION) || MKQL_RUNTIME_VERSION >= 29u
1005
1005
Y_UNIT_TEST_SUITE (TMiniKQLWideLastCombinerTest) {
1006
- Y_UNIT_TEST_LLVM (TestLongStringsRefCounting) {
1007
- TSetup<LLVM> setup (GetTestFactory (), {}, true );
1006
+ Y_UNIT_TEST_LLVM_SPILLING (TestLongStringsRefCounting) {
1007
+ // Currently LLVM version doesn't support spilling.
1008
+ if (LLVM && SPILLING) return ;
1009
+ // callable WideLastCombinerWithSpilling was introduced in 49 version of runtime
1010
+ if (MKQL_RUNTIME_VERSION < 49U && SPILLING) return ;
1011
+
1012
+ TSetup<LLVM, SPILLING> setup;
1008
1013
TProgramBuilder& pb = *setup.PgmBuilder ;
1009
1014
1010
1015
const auto dataType = pb.NewDataType (NUdf::TDataType<const char *>::Id);
@@ -1042,7 +1047,12 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideLastCombinerTest) {
1042
1047
1043
1048
const auto list = pb.NewList (tupleType, {data1, data2, data3, data4, data5, data6, data7, data8, data9});
1044
1049
1045
- const auto pgmReturn = pb.Collect (pb.NarrowMap (pb.WideLastCombinerWithSpilling (pb.ExpandMap (pb.ToFlow (list),
1050
+ auto wideLastCombinerCollable = &TProgramBuilder::WideLastCombiner;
1051
+ if (SPILLING) {
1052
+ wideLastCombinerCollable = &TProgramBuilder::WideLastCombinerWithSpilling;
1053
+ }
1054
+
1055
+ const auto pgmReturn = pb.Collect (pb.NarrowMap ((pb.*wideLastCombinerCollable)(pb.ExpandMap (pb.ToFlow (list),
1046
1056
[&](TRuntimeNode item) -> TRuntimeNode::TList { return {pb.Nth (item, 0U ), pb.Nth (item, 1U )}; }),
1047
1057
[&](TRuntimeNode::TList items) -> TRuntimeNode::TList { return {items.front ()}; },
1048
1058
[&](TRuntimeNode::TList keys, TRuntimeNode::TList items) -> TRuntimeNode::TList {
@@ -1066,7 +1076,9 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideLastCombinerTest) {
1066
1076
));
1067
1077
1068
1078
const auto graph = setup.BuildGraph (pgmReturn);
1069
- graph->GetContext ().SpillerFactory = std::make_shared<TMockSpillerFactory>();
1079
+ if (SPILLING) {
1080
+ graph->GetContext ().SpillerFactory = std::make_shared<TMockSpillerFactory>();
1081
+ }
1070
1082
const auto iterator = graph->GetValue ().GetListIterator ();
1071
1083
1072
1084
std::unordered_set<TString> expected {
@@ -1079,7 +1091,6 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideLastCombinerTest) {
1079
1091
NUdf::TUnboxedValue item;
1080
1092
while (!expected.empty ()) {
1081
1093
UNIT_ASSERT (iterator.Next (item));
1082
- // const auto actual = item.AsStringRef();
1083
1094
TString actual = item.AsStringRef ().Data ();
1084
1095
1085
1096
auto it = expected.find (actual);
@@ -1090,8 +1101,12 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideLastCombinerTest) {
1090
1101
UNIT_ASSERT (!iterator.Next (item));
1091
1102
}
1092
1103
1093
- Y_UNIT_TEST_LLVM (TestLongStringsPasstroughtRefCounting) {
1094
- TSetup<LLVM> setup;
1104
+ Y_UNIT_TEST_LLVM_SPILLING (TestLongStringsPasstroughtRefCounting) {
1105
+ // Currently LLVM version doesn't support spilling.
1106
+ if (LLVM && SPILLING) return ;
1107
+ // callable WideLastCombinerWithSpilling was introduced in 49 version of runtime
1108
+ if (MKQL_RUNTIME_VERSION < 49U && SPILLING) return ;
1109
+ TSetup<LLVM, SPILLING> setup;
1095
1110
TProgramBuilder& pb = *setup.PgmBuilder ;
1096
1111
1097
1112
const auto dataType = pb.NewDataType (NUdf::TDataType<const char *>::Id);
@@ -1128,7 +1143,11 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideLastCombinerTest) {
1128
1143
1129
1144
const auto list = pb.NewList (tupleType, {data1, data2, data3, data4, data5, data6, data7, data8, data9});
1130
1145
1131
- const auto pgmReturn = pb.Collect (pb.NarrowMap (pb.WideLastCombiner (pb.ExpandMap (pb.ToFlow (list),
1146
+ auto wideLastCombinerCollable = &TProgramBuilder::WideLastCombiner;
1147
+ if (SPILLING) {
1148
+ wideLastCombinerCollable = &TProgramBuilder::WideLastCombinerWithSpilling;
1149
+ }
1150
+ const auto pgmReturn = pb.Collect (pb.NarrowMap ((pb.*wideLastCombinerCollable)(pb.ExpandMap (pb.ToFlow (list),
1132
1151
[&](TRuntimeNode item) -> TRuntimeNode::TList { return {pb.Nth (item, 0U ), pb.Nth (item, 1U )}; }),
1133
1152
[&](TRuntimeNode::TList items) -> TRuntimeNode::TList { return {items.front ()}; },
1134
1153
[&](TRuntimeNode::TList keys, TRuntimeNode::TList items) -> TRuntimeNode::TList {
@@ -1151,22 +1170,37 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideLastCombinerTest) {
1151
1170
));
1152
1171
1153
1172
const auto graph = setup.BuildGraph (pgmReturn);
1173
+ if (SPILLING) {
1174
+ graph->GetContext ().SpillerFactory = std::make_shared<TMockSpillerFactory>();
1175
+ }
1154
1176
const auto iterator = graph->GetValue ().GetListIterator ();
1177
+
1178
+ std::unordered_set<TString> expected {
1179
+ " very long value 1 / key one / very long value 1 / key one" ,
1180
+ " very long value 3 / key two / very long value 2 / key two" ,
1181
+ " very long value 4 / very long key one / very long value 4 / very long key one" ,
1182
+ " very long value 9 / very long key two / very long value 5 / very long key two"
1183
+ };
1184
+
1155
1185
NUdf::TUnboxedValue item;
1156
- UNIT_ASSERT (iterator. Next (item));
1157
- UNBOXED_VALUE_STR_EQUAL (item, " very long value 1 / key one / very long value 1 / key one " );
1158
- UNIT_ASSERT (iterator. Next (item) );
1159
- UNBOXED_VALUE_STR_EQUAL (item, " very long value 3 / key two / very long value 2 / key two " );
1160
- UNIT_ASSERT (iterator. Next (item) );
1161
- UNBOXED_VALUE_STR_EQUAL (item, " very long value 4 / very long key one / very long value 4 / very long key one " );
1162
- UNIT_ASSERT (iterator. Next (item) );
1163
- UNBOXED_VALUE_STR_EQUAL (item, " very long value 9 / very long key two / very long value 5 / very long key two " );
1186
+ while (!expected. empty ()) {
1187
+ UNIT_ASSERT (iterator. Next (item) );
1188
+ TString actual = item. AsStringRef (). Data ( );
1189
+
1190
+ auto it = expected. find (actual );
1191
+ UNIT_ASSERT (it != expected. end () );
1192
+ expected. erase (it );
1193
+ }
1164
1194
UNIT_ASSERT (!iterator.Next (item));
1165
1195
UNIT_ASSERT (!iterator.Next (item));
1166
1196
}
1167
1197
1168
- Y_UNIT_TEST_LLVM (TestDoNotCalculateUnusedInput) {
1169
- TSetup<LLVM> setup;
1198
+ Y_UNIT_TEST_LLVM_SPILLING (TestDoNotCalculateUnusedInput) {
1199
+ // Currently LLVM version doesn't support spilling.
1200
+ if (LLVM && SPILLING) return ;
1201
+ // callable WideLastCombinerWithSpilling was introduced in 49 version of runtime
1202
+ if (MKQL_RUNTIME_VERSION < 49U && SPILLING) return ;
1203
+ TSetup<LLVM, SPILLING> setup;
1170
1204
TProgramBuilder& pb = *setup.PgmBuilder ;
1171
1205
1172
1206
const auto dataType = pb.NewDataType (NUdf::TDataType<const char *>::Id);
@@ -1200,7 +1234,11 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideLastCombinerTest) {
1200
1234
1201
1235
const auto landmine = pb.NewDataLiteral <NUdf::EDataSlot::String>(" ACHTUNG MINEN!" );
1202
1236
1203
- const auto pgmReturn = pb.Collect (pb.NarrowMap (pb.WideLastCombiner (pb.ExpandMap (pb.ToFlow (list),
1237
+ auto wideLastCombinerCollable = &TProgramBuilder::WideLastCombiner;
1238
+ if (SPILLING) {
1239
+ wideLastCombinerCollable = &TProgramBuilder::WideLastCombinerWithSpilling;
1240
+ }
1241
+ const auto pgmReturn = pb.Collect (pb.NarrowMap ((pb.*wideLastCombinerCollable)(pb.ExpandMap (pb.ToFlow (list),
1204
1242
[&](TRuntimeNode item) -> TRuntimeNode::TList { return {pb.Nth (item, 0U ), pb.Unwrap (pb.Nth (item, 1U ), landmine, __FILE__, __LINE__, 0 ), pb.Nth (item, 2U )}; }),
1205
1243
[&](TRuntimeNode::TList items) -> TRuntimeNode::TList { return {items.front ()}; },
1206
1244
[&](TRuntimeNode::TList keys, TRuntimeNode::TList items) -> TRuntimeNode::TList {
@@ -1224,12 +1262,24 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideLastCombinerTest) {
1224
1262
));
1225
1263
1226
1264
const auto graph = setup.BuildGraph (pgmReturn);
1265
+ if (SPILLING) {
1266
+ graph->GetContext ().SpillerFactory = std::make_shared<TMockSpillerFactory>();
1267
+ }
1268
+ std::unordered_set<TString> expected {
1269
+ " key one / value 2 / value 1 / value 5 / value 4" ,
1270
+ " key two / value 4 / value 3 / value 3 / value 2"
1271
+ };
1272
+
1227
1273
const auto iterator = graph->GetValue ().GetListIterator ();
1228
1274
NUdf::TUnboxedValue item;
1229
- UNIT_ASSERT (iterator.Next (item));
1230
- UNBOXED_VALUE_STR_EQUAL (item, " key one / value 2 / value 1 / value 5 / value 4" );
1231
- UNIT_ASSERT (iterator.Next (item));
1232
- UNBOXED_VALUE_STR_EQUAL (item, " key two / value 4 / value 3 / value 3 / value 2" );
1275
+ while (!expected.empty ()) {
1276
+ UNIT_ASSERT (iterator.Next (item));
1277
+ TString actual = item.AsStringRef ().Data ();
1278
+
1279
+ auto it = expected.find (actual);
1280
+ UNIT_ASSERT (it != expected.end ());
1281
+ expected.erase (it);
1282
+ }
1233
1283
UNIT_ASSERT (!iterator.Next (item));
1234
1284
UNIT_ASSERT (!iterator.Next (item));
1235
1285
}
0 commit comments