Skip to content

Commit 170b5d9

Browse files
committed
added all tests
1 parent 1e82ca6 commit 170b5d9

File tree

1 file changed

+38
-10
lines changed

1 file changed

+38
-10
lines changed

ydb/library/yql/minikql/comp_nodes/ut/mkql_wide_combine_ut.cpp

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,8 +1284,12 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideLastCombinerTest) {
12841284
UNIT_ASSERT(!iterator.Next(item));
12851285
}
12861286

1287-
Y_UNIT_TEST_LLVM(TestDoNotCalculateUnusedOutput) {
1288-
TSetup<LLVM> setup;
1287+
Y_UNIT_TEST_LLVM_SPILLING(TestDoNotCalculateUnusedOutput) {
1288+
// Currently LLVM version doesn't support spilling.
1289+
if (LLVM && SPILLING) return;
1290+
// callable WideLastCombinerWithSpilling was introduced in 49 version of runtime
1291+
if (MKQL_RUNTIME_VERSION < 49U && SPILLING) return;
1292+
TSetup<LLVM, SPILLING> setup;
12891293
TProgramBuilder& pb = *setup.PgmBuilder;
12901294

12911295
const auto dataType = pb.NewDataType(NUdf::TDataType<const char*>::Id);
@@ -1319,7 +1323,11 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideLastCombinerTest) {
13191323

13201324
const auto landmine = pb.NewDataLiteral<NUdf::EDataSlot::String>("ACHTUNG MINEN!");
13211325

1322-
const auto pgmReturn = pb.Collect(pb.NarrowMap(pb.WideLastCombiner(pb.ExpandMap(pb.ToFlow(list),
1326+
auto wideLastCombinerCollable = &TProgramBuilder::WideLastCombiner;
1327+
if (SPILLING) {
1328+
wideLastCombinerCollable = &TProgramBuilder::WideLastCombinerWithSpilling;
1329+
}
1330+
const auto pgmReturn = pb.Collect(pb.NarrowMap((pb.*wideLastCombinerCollable)(pb.ExpandMap(pb.ToFlow(list),
13231331
[&](TRuntimeNode item) -> TRuntimeNode::TList { return {pb.Nth(item, 0U), pb.Nth(item, 1U), pb.Nth(item, 2U)}; }),
13241332
[&](TRuntimeNode::TList items) -> TRuntimeNode::TList { return {items.front()}; },
13251333
[&](TRuntimeNode::TList, TRuntimeNode::TList items) -> TRuntimeNode::TList {
@@ -1335,26 +1343,46 @@ Y_UNIT_TEST_SUITE(TMiniKQLWideLastCombinerTest) {
13351343
));
13361344

13371345
const auto graph = setup.BuildGraph(pgmReturn);
1346+
if (SPILLING) {
1347+
graph->GetContext().SpillerFactory = std::make_shared<TMockSpillerFactory>();
1348+
}
1349+
std::unordered_set<TString> expected {
1350+
"key one: value 1, value 4, value 5, value 1, value 2",
1351+
"key two: value 2, value 3, value 3, value 4"
1352+
};
1353+
13381354
const auto iterator = graph->GetValue().GetListIterator();
13391355
NUdf::TUnboxedValue item;
1340-
UNIT_ASSERT(iterator.Next(item));
1341-
UNBOXED_VALUE_STR_EQUAL(item, "key one: value 1, value 4, value 5, value 1, value 2");
1342-
UNIT_ASSERT(iterator.Next(item));
1343-
UNBOXED_VALUE_STR_EQUAL(item, "key two: value 2, value 3, value 3, value 4");
1356+
while (!expected.empty()) {
1357+
UNIT_ASSERT(iterator.Next(item));
1358+
TString actual = item.AsStringRef().Data();
1359+
1360+
auto it = expected.find(actual);
1361+
UNIT_ASSERT(it != expected.end());
1362+
expected.erase(it);
1363+
}
13441364
UNIT_ASSERT(!iterator.Next(item));
13451365
UNIT_ASSERT(!iterator.Next(item));
13461366
}
13471367

1348-
Y_UNIT_TEST_LLVM(TestThinAllLambdas) {
1349-
TSetup<LLVM> setup;
1368+
Y_UNIT_TEST_LLVM_SPILLING(TestThinAllLambdas) {
1369+
// Currently LLVM version doesn't support spilling.
1370+
if (LLVM && SPILLING) return;
1371+
// callable WideLastCombinerWithSpilling was introduced in 49 version of runtime
1372+
if (MKQL_RUNTIME_VERSION < 49U && SPILLING) return;
1373+
TSetup<LLVM, SPILLING> setup;
13501374
TProgramBuilder& pb = *setup.PgmBuilder;
13511375

13521376
const auto tupleType = pb.NewTupleType({});
13531377
const auto data = pb.NewTuple({});
13541378

13551379
const auto list = pb.NewList(tupleType, {data, data, data, data});
13561380

1357-
const auto pgmReturn = pb.Collect(pb.NarrowMap(pb.WideLastCombiner(pb.ExpandMap(pb.ToFlow(list),
1381+
auto wideLastCombinerCollable = &TProgramBuilder::WideLastCombiner;
1382+
if (SPILLING) {
1383+
wideLastCombinerCollable = &TProgramBuilder::WideLastCombinerWithSpilling;
1384+
}
1385+
const auto pgmReturn = pb.Collect(pb.NarrowMap((pb.*wideLastCombinerCollable)(pb.ExpandMap(pb.ToFlow(list),
13581386
[](TRuntimeNode) -> TRuntimeNode::TList { return {}; }),
13591387
[](TRuntimeNode::TList items) { return items; },
13601388
[](TRuntimeNode::TList, TRuntimeNode::TList items) { return items; },

0 commit comments

Comments
 (0)