diff options
author | imunkin <imunkin@yandex-team.com> | 2025-04-15 20:43:49 +0300 |
---|---|---|
committer | imunkin <imunkin@yandex-team.com> | 2025-04-15 21:38:32 +0300 |
commit | 99be0c2021948af5599a38f3f205529e3a87b4f4 (patch) | |
tree | ae2e0d05906a6b84d45313aba14025012ef70508 | |
parent | c55df1f45e443ae9828d7e2c12a6215c28425ff9 (diff) | |
download | ydb-99be0c2021948af5599a38f3f205529e3a87b4f4.tar.gz |
YQL-19836: Fix the dependency for Iterable lambda argument
commit_hash:cc7563be3ee8e0b04bdf034a5e14e7595f79c5a5
-rw-r--r-- | yql/essentials/minikql/comp_nodes/mkql_iterable.cpp | 2 | ||||
-rw-r--r-- | yql/essentials/minikql/comp_nodes/ut/mkql_iterable_ut.cpp | 40 | ||||
-rw-r--r-- | yql/essentials/minikql/comp_nodes/ut/ya.make.inc | 1 |
3 files changed, 42 insertions, 1 deletions
diff --git a/yql/essentials/minikql/comp_nodes/mkql_iterable.cpp b/yql/essentials/minikql/comp_nodes/mkql_iterable.cpp index f5602fb8e85..4036b225dc5 100644 --- a/yql/essentials/minikql/comp_nodes/mkql_iterable.cpp +++ b/yql/essentials/minikql/comp_nodes/mkql_iterable.cpp @@ -123,7 +123,7 @@ public: private: void RegisterDependencies() const final { DependsOn(Stream); - Arg->AddDependence(Stream); + Own(Arg); } IComputationNode* const Stream; diff --git a/yql/essentials/minikql/comp_nodes/ut/mkql_iterable_ut.cpp b/yql/essentials/minikql/comp_nodes/ut/mkql_iterable_ut.cpp new file mode 100644 index 00000000000..4060beb5507 --- /dev/null +++ b/yql/essentials/minikql/comp_nodes/ut/mkql_iterable_ut.cpp @@ -0,0 +1,40 @@ +#include "mkql_computation_node_ut.h" + +namespace NKikimr::NMiniKQL { + +Y_UNIT_TEST_SUITE(TMiniKQLIterableTest) { + + // This particular test builds the graph similar to the one + // below, that is a part of the reproducer in YQL-19836. + // (return SqueezeToDict (Map (ToFlow (Iterable + // (lambda '() (EmptyIterator (StreamType (StructType '('"a" (DataType 'Uint64)))))) + // )) (lambda '($9) '((Member $9 '"a") $9))) + // (lambda '($10) (Nth $10 '0)) + // (lambda '($11) (Nth $11 '1)) + // '('Many 'Hashed 'Compact)) + Y_UNIT_TEST_LLVM(TestEmptyIterable) { + TSetup<LLVM> setup; + TProgramBuilder& pb = *setup.PgmBuilder; + + const TProgramBuilder::TZeroLambda lambda = [&pb]() { + return pb.EmptyIterator(pb.NewStreamType(pb.NewStructType({ + {"a", pb.NewDataType(NUdf::EDataSlot::Uint64)} + }))); + }; + const auto root = pb.SqueezeToHashedDict( + pb.ToFlow(pb.Iterable(lambda)), + /* isMany = */ true, + [&pb](TRuntimeNode node) { return pb.Member(node, "a"); }, + [](TRuntimeNode node) { return node; }, + /* isCompact = */ true + ); + auto graph = setup.BuildGraph(root); + NUdf::TUnboxedValue dict = graph->GetValue(); + + UNIT_ASSERT(!dict.IsSpecial()); + UNIT_ASSERT_EQUAL(dict.GetDictLength(), 0); + } + +} // Y_UNIT_TEST_SUITE(TMiniKQLIterableTest) + +} // namespace NKikimr::NMiniKQL diff --git a/yql/essentials/minikql/comp_nodes/ut/ya.make.inc b/yql/essentials/minikql/comp_nodes/ut/ya.make.inc index 73c063d865c..aa6ff27a465 100644 --- a/yql/essentials/minikql/comp_nodes/ut/ya.make.inc +++ b/yql/essentials/minikql/comp_nodes/ut/ya.make.inc @@ -51,6 +51,7 @@ SET(ORIG_SOURCES mkql_group_ut.cpp mkql_dict_ut.cpp mkql_isa_detection_ut.cpp + mkql_iterable_ut.cpp mkql_join_ut.cpp mkql_join_dict_ut.cpp mkql_grace_join_ut.cpp |