From fdad65c21adc004c3d6af50e71944f4737be18db Mon Sep 17 00:00:00 2001 From: Andrey Kulaga Date: Thu, 11 Jan 2024 15:46:01 +0000 Subject: [PATCH 1/2] Fix for full join when keys for both tables are identical --- ydb/library/yql/minikql/comp_nodes/mkql_grace_join_imp.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_grace_join_imp.cpp b/ydb/library/yql/minikql/comp_nodes/mkql_grace_join_imp.cpp index a1b1ff78df53..2681d89fab75 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_grace_join_imp.cpp +++ b/ydb/library/yql/minikql/comp_nodes/mkql_grace_join_imp.cpp @@ -157,6 +157,7 @@ void TTable::ResetIterator() { CurrIterIndex = 0; CurrIterBucket = 0; CurrJoinIdsIterIndex = 0; + Table2Initialized_ = false; if (IsTableJoined) { JoinTable1->ResetIterator(); JoinTable2->ResetIterator(); @@ -1032,6 +1033,12 @@ bool TTable::NextJoinedData( TupleData & td1, TupleData & td2) { } td1.AllNulls = true; + if (!Table2Initialized_) { + CurrIterBucket = 0; + CurrJoinIdsIterIndex = 0; + Table2Initialized_ = true; + } + while (HasMoreTuples(JoinTable2->TableBuckets, JoinTable2->CurrIterBucket, JoinTable2->CurrIterIndex)) { if (CurrIterBucket != JoinTable2->CurrIterBucket) { From 888fbf6fe976d8a7e91118f0f956b2d1c04b54e8 Mon Sep 17 00:00:00 2001 From: Andrey Kulaga Date: Fri, 12 Jan 2024 07:45:27 +0000 Subject: [PATCH 2/2] Added missing changes in header file --- ydb/library/yql/minikql/comp_nodes/mkql_grace_join_imp.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ydb/library/yql/minikql/comp_nodes/mkql_grace_join_imp.h b/ydb/library/yql/minikql/comp_nodes/mkql_grace_join_imp.h index 20f1c8faf28b..3eb2056d02df 100644 --- a/ydb/library/yql/minikql/comp_nodes/mkql_grace_join_imp.h +++ b/ydb/library/yql/minikql/comp_nodes/mkql_grace_join_imp.h @@ -167,6 +167,8 @@ class TTable { bool IsAny_ = false; // True if key duplicates need to be removed from table (any join) + bool Table2Initialized_ = false; // True when iterator counters for second table already initialized + public: // Adds new tuple to the table. intColumns, stringColumns - data of columns,