query: use result_view::consume() where appropriate
Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
This commit is contained in:
@@ -186,20 +186,9 @@ result_set_builder::deserialize(const result_row_view& row, bool is_static)
|
||||
|
||||
result_set
|
||||
result_set::from_raw_result(schema_ptr s, const partition_slice& slice, const result& r) {
|
||||
auto make = [&slice, s = std::move(s)] (bytes_view v) mutable {
|
||||
result_set_builder builder{std::move(s), slice};
|
||||
result_view view(v);
|
||||
view.consume(slice, builder);
|
||||
return builder.build();
|
||||
};
|
||||
|
||||
if (r.buf().is_linearized()) {
|
||||
return make(r.buf().view());
|
||||
} else {
|
||||
// FIXME: make result_view::consume() work on fragments to avoid linearization.
|
||||
bytes_ostream w(r.buf());
|
||||
return make(w.linearize());
|
||||
}
|
||||
result_set_builder builder{std::move(s), slice};
|
||||
result_view::consume(r, slice, builder);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
result_set::result_set(const mutation& m) : result_set([&m] {
|
||||
|
||||
13
query.cc
13
query.cc
@@ -170,18 +170,7 @@ uint32_t result::calculate_row_count(const query::partition_slice& slice) {
|
||||
}
|
||||
} counter;
|
||||
|
||||
bytes_view v;
|
||||
|
||||
if (buf().is_linearized()) {
|
||||
v = buf().view();
|
||||
} else {
|
||||
// FIXME: make result_view::consume() work on fragments to avoid linearization.
|
||||
bytes_ostream w(buf());
|
||||
v = w.linearize();
|
||||
}
|
||||
|
||||
query::result_view view(v);
|
||||
view.consume(slice, counter);
|
||||
result_view::consume(*this, slice, counter);
|
||||
return counter.total_count;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user