Skip to content

Commit dd11a80

Browse files
uzhastikEgorkaZ
authored andcommitted
fix coverity issues: evaluation order violations (ydb-platform#1556)
* fix coverity issues * fix build * fix build * fix build again
1 parent b7e863d commit dd11a80

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ydb/library/yql/ast/yql_constraint.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,8 @@ TSortedConstraintNode::DoGetSimplifiedForType(const TTypeAnnotationNode& type, T
542542
++it;
543543

544544
if (ssize_t(GetElementsCount(subType)) == std::distance(from, it)) {
545-
*from++ = std::make_pair(TPartOfConstraintBase::TSetType{std::move(prefix)}, from->second);
545+
*from = std::make_pair(TPartOfConstraintBase::TSetType{std::move(prefix)}, from->second);
546+
++from;
546547
it = content.erase(from, it);
547548
changed = setChanged = true;
548549
}

ydb/library/yql/core/common_opt/yql_co_simple1.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -3087,8 +3087,8 @@ std::unordered_set<ui32> GetUselessSortedJoinInputs(const TCoEquiJoin& equiJoin)
30873087
if (!joinTree->Head().IsAtom("Cross")) {
30883088
std::unordered_map<std::string_view, TPartOfConstraintBase::TSetType> tableJoinKeys;
30893089
for (const auto keys : {joinTree->Child(3), joinTree->Child(4)})
3090-
for (ui32 i = 0U; i < keys->ChildrenSize(); ++i)
3091-
tableJoinKeys[keys->Child(i)->Content()].insert_unique(TPartOfConstraintBase::TPathType(1U, keys->Child(++i)->Content()));
3090+
for (ui32 i = 0U; i < keys->ChildrenSize(); i += 2)
3091+
tableJoinKeys[keys->Child(i)->Content()].insert_unique(TPartOfConstraintBase::TPathType(1U, keys->Child(i + 1)->Content()));
30923092

30933093
for (const auto& [label, joinKeys]: tableJoinKeys) {
30943094
if (const auto it = sorteds.find(label); sorteds.cend() != it) {

0 commit comments

Comments
 (0)