aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora-romanov <Anton.Romanov@ydb.tech>2022-12-21 19:04:18 +0300
committera-romanov <Anton.Romanov@ydb.tech>2022-12-21 19:04:18 +0300
commit48f3e49f4b8f6684b3610c940c97c236ed1e0104 (patch)
tree33250f2c395db0d2bf3320edfbad278fc3876c4f
parentb1b8ff242fbd109c0b03c2a0ab99c3e196ec1e2e (diff)
downloadydb-48f3e49f4b8f6684b3610c940c97c236ed1e0104.tar.gz
Fix about hash join.
-rw-r--r--ydb/library/yql/dq/opt/dq_opt_join.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/ydb/library/yql/dq/opt/dq_opt_join.cpp b/ydb/library/yql/dq/opt/dq_opt_join.cpp
index 5e99d0a8ad..87b55ee3ee 100644
--- a/ydb/library/yql/dq/opt/dq_opt_join.cpp
+++ b/ydb/library/yql/dq/opt/dq_opt_join.cpp
@@ -255,13 +255,13 @@ std::pair<TVector<TCoAtom>, TVector<TCoAtom>> GetJoinKeys(const TDqJoin& join, T
auto rightLabel = keyTuple.RightLabel().Value();
auto leftKey = Build<TCoAtom>(ctx, join.Pos())
- .Value(join.LeftLabel().Maybe<TCoAtom>()
+ .Value(join.LeftLabel().Maybe<TCoAtom>() || keyTuple.LeftColumn().Value().starts_with("_yql_dq_key_left_")
? keyTuple.LeftColumn().StringValue()
: FullColumnName(leftLabel, keyTuple.LeftColumn().Value()))
.Done();
auto rightKey = Build<TCoAtom>(ctx, join.Pos())
- .Value(join.RightLabel().Maybe<TCoAtom>()
+ .Value(join.RightLabel().Maybe<TCoAtom>() || keyTuple.RightColumn().Value().starts_with("_yql_dq_key_right_")
? keyTuple.RightColumn().StringValue()
: FullColumnName(rightLabel, keyTuple.RightColumn().Value()))
.Done();
@@ -1054,6 +1054,7 @@ TExprBase DqBuildHashJoin(const TDqJoin& join, EHashJoinMode mode, TExprContext&
for (ui32 i = 0U; i < rightJoinKeys.size() && !badKey; ++i) {
const auto keyType1 = leftStructType->FindItemType(leftJoinKeys[i]);
const auto keyType2 = rightStructType->FindItemType(rightJoinKeys[i]);
+ YQL_ENSURE(keyType1 && keyType2, "Missed key column.");
const TTypeAnnotationNode* commonType = nullptr;
if (leftKind) {
commonType = JoinDryKeyType(!filter, keyType1, keyType2, ctx);