Skip to content

Commit

Permalink
query: use result_view::consume() where appropriate
Browse files Browse the repository at this point in the history
Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
  • Loading branch information
pdziepak committed Aug 22, 2016
1 parent cb2a557 commit 3fe5ed3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
17 changes: 3 additions & 14 deletions query-result-set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand Down
13 changes: 1 addition & 12 deletions query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 3fe5ed3

Please sign in to comment.