Skip to content

CalculateKeyBytes operator precedence fix #4503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading