Skip to content

Commit

Permalink
fix coverity issues: evaluation order violations (ydb-platform#1556)
Browse files Browse the repository at this point in the history
* fix coverity issues

* fix build

* fix build

* fix build again
  • Loading branch information
uzhastik authored and EgorkaZ committed Apr 5, 2024
1 parent 8259204 commit 8c51114
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ydb/library/yql/ast/yql_constraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,8 @@ TSortedConstraintNode::DoGetSimplifiedForType(const TTypeAnnotationNode& type, T
++it;

if (ssize_t(GetElementsCount(subType)) == std::distance(from, it)) {
*from++ = std::make_pair(TPartOfConstraintBase::TSetType{std::move(prefix)}, from->second);
*from = std::make_pair(TPartOfConstraintBase::TSetType{std::move(prefix)}, from->second);
++from;
it = content.erase(from, it);
changed = setChanged = true;
}
Expand Down
4 changes: 2 additions & 2 deletions ydb/library/yql/core/common_opt/yql_co_simple1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3087,8 +3087,8 @@ std::unordered_set<ui32> GetUselessSortedJoinInputs(const TCoEquiJoin& equiJoin)
if (!joinTree->Head().IsAtom("Cross")) {
std::unordered_map<std::string_view, TPartOfConstraintBase::TSetType> tableJoinKeys;
for (const auto keys : {joinTree->Child(3), joinTree->Child(4)})
for (ui32 i = 0U; i < keys->ChildrenSize(); ++i)
tableJoinKeys[keys->Child(i)->Content()].insert_unique(TPartOfConstraintBase::TPathType(1U, keys->Child(++i)->Content()));
for (ui32 i = 0U; i < keys->ChildrenSize(); i += 2)
tableJoinKeys[keys->Child(i)->Content()].insert_unique(TPartOfConstraintBase::TPathType(1U, keys->Child(i + 1)->Content()));

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

0 comments on commit 8c51114

Please sign in to comment.