mutation_query: reconcilable_result: add merge_disjoint()

Merging two disjoint reconcilable_result instances.
This commit is contained in:
Botond Dénes
2024-01-11 05:53:22 -05:00
parent 7bdd0c2cae
commit 35e6cbf42e
2 changed files with 13 additions and 0 deletions

View File

@@ -42,6 +42,15 @@ reconcilable_result::operator==(const reconcilable_result& other) const {
return boost::equal(_partitions, other._partitions);
}
void
reconcilable_result::merge_disjoint(schema_ptr schema, const reconcilable_result& other) {
std::copy(other._partitions.begin(), other._partitions.end(), std::back_inserter(_partitions));
_short_read = _short_read || other._short_read;
uint64_t row_count = this->row_count() + other.row_count();
_row_count_low_bits = static_cast<uint32_t>(row_count);
_row_count_high_bits = static_cast<uint32_t>(row_count >> 32);
}
auto fmt::formatter<reconcilable_result::printer>::format(
const reconcilable_result::printer& pr,
fmt::format_context& ctx) const -> decltype(ctx.out()) {

View File

@@ -108,6 +108,10 @@ public:
bool operator==(const reconcilable_result& other) const;
// other must be disjoint with this
// does not merge or update memory trackers
void merge_disjoint(schema_ptr schema, const reconcilable_result& other);
struct printer {
const reconcilable_result& self;
schema_ptr schema;