Skip to content

Commit bbad9a4

Browse files
Cleaned up code that removes aliases from attributes (#7745)
1 parent 1130be0 commit bbad9a4

File tree

4 files changed

+11
-21
lines changed

4 files changed

+11
-21
lines changed

ydb/core/kqp/ut/join/kqp_join_order_ut.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ Y_UNIT_TEST_SUITE(KqpJoinOrder) {
253253
ExecuteJoinOrderTestDataQueryWithStats("queries/four_way_join_with_preds_and_equiv.sql", "stats/basic.json", StreamLookupJoin);
254254
}
255255

256-
//Y_UNIT_TEST_TWIN(FourWayJoinWithPredsAndEquivAndLeft, StreamLookupJoin) {
257-
// ExecuteJoinOrderTestDataQueryWithStats("queries/four_way_join_with_preds_and_equiv_and_left.sql", "stats/basic.json", StreamLookupJoin);
258-
//}
256+
Y_UNIT_TEST_TWIN(FourWayJoinWithPredsAndEquivAndLeft, StreamLookupJoin) {
257+
ExecuteJoinOrderTestDataQueryWithStats("queries/four_way_join_with_preds_and_equiv_and_left.sql", "stats/basic.json", StreamLookupJoin);
258+
}
259259

260260
Y_UNIT_TEST_TWIN(TestJoinHint, StreamLookupJoin) {
261261
CheckJoinCardinality("queries/test_join_hint.sql", "stats/basic.json", "InnerJoin (Grace)", 10e6, StreamLookupJoin);

ydb/library/yql/dq/opt/dq_opt_join_hypergraph.h

+4-10
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,12 @@ class TJoinHypergraph {
6767
auto leftKey = left.AttributeName;
6868
auto rightKey = right.AttributeName;
6969

70-
for (size_t i = leftKey.size() - 1; i > 0; --i) {
71-
if (leftKey[i] == '.') {
72-
leftKey = leftKey.substr(i + 1);
73-
break;
74-
}
70+
if (auto idx = leftKey.find_last_of('.') != TString::npos) {
71+
leftKey = leftKey.substr(idx+1);
7572
}
7673

77-
for (size_t i = rightKey.size() - 1; i > 0; --i) {
78-
if (rightKey[i] == '.') {
79-
rightKey = rightKey.substr(i + 1);
80-
break;
81-
}
74+
if (auto idx = rightKey.find_last_of('.') != TString::npos) {
75+
rightKey = rightKey.substr(idx+1);
8276
}
8377

8478
LeftJoinKeys.emplace_back(leftKey);

ydb/library/yql/dq/opt/dq_opt_stat.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ namespace {
2424

2525

2626
TString RemoveAliases(TString attributeName) {
27-
for (size_t i = attributeName.size() - 1; i>0; i--) {
28-
if (attributeName[i]=='.') {
29-
return attributeName.substr(i+1);
30-
}
27+
if (auto idx = attributeName.find_last_of('.') != TString::npos) {
28+
return attributeName.substr(idx+1);
3129
}
3230
return attributeName;
3331
}

ydb/library/yql/providers/dq/planner/execution_planner.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ using namespace Yql::DqsProto;
4242

4343
namespace {
4444
TString RemoveAliases(TString attributeName) {
45-
for (size_t i = attributeName.size() - 1; i>0; i--) {
46-
if (attributeName[i]=='.') {
47-
return attributeName.substr(i+1);
48-
}
45+
if (auto idx = attributeName.find_last_of('.') != TString::npos) {
46+
return attributeName.substr(idx+1);
4947
}
5048
return attributeName;
5149
}

0 commit comments

Comments
 (0)