mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
column_computation: adjust to use clustering_or_static_row
Adjusts the column_computation interface so that it is able to accept both clustering and static rows through the common db::view::clustering_or_static_row interface.
This commit is contained in:
@@ -12,11 +12,11 @@
|
||||
|
||||
class schema;
|
||||
class partition_key;
|
||||
class clustering_row;
|
||||
struct atomic_cell_view;
|
||||
struct tombstone;
|
||||
|
||||
namespace db::view {
|
||||
struct clustering_or_static_row;
|
||||
struct view_key_and_action;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class collection_column_computation final : public column_computation {
|
||||
using collection_kv = std::pair<bytes_view, atomic_cell_view>;
|
||||
void operate_on_collection_entries(
|
||||
std::invocable<collection_kv*, collection_kv*, tombstone> auto&& old_and_new_row_func, const schema& schema,
|
||||
const partition_key& key, const clustering_row& update, const std::optional<clustering_row>& existing) const;
|
||||
const partition_key& key, const db::view::clustering_or_static_row& update, const std::optional<db::view::clustering_or_static_row>& existing) const;
|
||||
|
||||
public:
|
||||
static collection_column_computation for_keys(const bytes& collection_name) {
|
||||
@@ -141,5 +141,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<db::view::view_key_and_action> compute_values_with_action(const schema& schema, const partition_key& key, const clustering_row& row, const std::optional<clustering_row>& existing) const;
|
||||
std::vector<db::view::view_key_and_action> compute_values_with_action(const schema& schema, const partition_key& key,
|
||||
const db::view::clustering_or_static_row& row, const std::optional<db::view::clustering_or_static_row>& existing) const;
|
||||
};
|
||||
|
||||
@@ -620,7 +620,13 @@ private:
|
||||
}
|
||||
collection_column_position = column_position - 1;
|
||||
|
||||
for (auto& bwa : collection_computation->compute_values_with_action(_base, _base_key, _update, _existing)) {
|
||||
// TODO: Introduced just for the sake of clear commit history, will be removed in following commits
|
||||
const auto update = clustering_or_static_row(clustering_row(_base, _update));
|
||||
const auto existing = _existing
|
||||
? std::make_optional<clustering_or_static_row>(clustering_row(_base, *_existing))
|
||||
: std::nullopt;
|
||||
|
||||
for (auto& bwa : collection_computation->compute_values_with_action(_base, _base_key, update, existing)) {
|
||||
ret.push_back({std::move(bwa), linearized_values});
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -1770,7 +1770,7 @@ column_computation_ptr collection_column_computation::for_target_type(std::strin
|
||||
|
||||
void collection_column_computation::operate_on_collection_entries(
|
||||
std::invocable<collection_kv*, collection_kv*, tombstone> auto&& old_and_new_row_func, const schema& schema,
|
||||
const partition_key& key, const clustering_row& update, const std::optional<clustering_row>& existing) const {
|
||||
const partition_key& key, const db::view::clustering_or_static_row& update, const std::optional<db::view::clustering_or_static_row>& existing) const {
|
||||
|
||||
const column_definition* cdef = schema.get_column_definition(_collection_name);
|
||||
|
||||
@@ -1840,7 +1840,8 @@ bytes collection_column_computation::compute_value(const schema&, const partitio
|
||||
throw std::runtime_error(fmt::format("{}: not supported", __PRETTY_FUNCTION__));
|
||||
}
|
||||
|
||||
std::vector<db::view::view_key_and_action> collection_column_computation::compute_values_with_action(const schema& schema, const partition_key& key, const clustering_row& update, const std::optional<clustering_row>& existing) const {
|
||||
std::vector<db::view::view_key_and_action> collection_column_computation::compute_values_with_action(const schema& schema, const partition_key& key,
|
||||
const db::view::clustering_or_static_row& update, const std::optional<db::view::clustering_or_static_row>& existing) const {
|
||||
using collection_kv = std::pair<bytes_view, atomic_cell_view>;
|
||||
auto serialize_cell = [_kind = _kind](const collection_kv& kv) -> bytes {
|
||||
using kind = collection_column_computation::kind;
|
||||
|
||||
Reference in New Issue
Block a user