Skip to content

Commit

Permalink
CalculateKeyBytes operator precedence fix (#4504)
Browse files Browse the repository at this point in the history
  • Loading branch information
azevaykin authored May 14, 2024
1 parent adbde26 commit da78771
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ydb/core/tx/datashard/datashard_user_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,17 @@ NTable::EReady TDataShardUserDb::SelectRow(
}

ui64 CalculateKeyBytes(const TArrayRef<const TRawTypeValue> key) {
return std::accumulate(key.begin(), key.end(), 0, [](ui64 bytes, const TRawTypeValue& value) { return bytes + value.IsEmpty() ? 1 : value.Size(); });
ui64 bytes = 0ull;
for (const TRawTypeValue& value : key)
bytes += value.IsEmpty() ? 1ull : value.Size();
return bytes;
};

ui64 CalculateValueBytes(const TArrayRef<const NIceDb::TUpdateOp> ops) {
return std::accumulate(ops.begin(), ops.end(), 0, [](ui64 bytes, const NIceDb::TUpdateOp& op) { return bytes + op.Value.IsEmpty() ? 1 : op.Value.Size(); });
ui64 bytes = 0ull;
for (const NIceDb::TUpdateOp& op : ops)
bytes += op.Value.IsEmpty() ? 1ull : op.Value.Size();
return bytes;
};

void TDataShardUserDb::UpdateRow(
Expand Down

0 comments on commit da78771

Please sign in to comment.