query-request: Add reversed function to reverse read_command
The read_command is reversed by reversing the schema version it holds and transforming a slice from the legacy reversed format to the native reversed format. Use for trasition between format and to support mixed-nodes clusters
This commit is contained in:
@@ -475,6 +475,12 @@ public:
|
||||
friend std::ostream& operator<<(std::ostream& out, const read_command& r);
|
||||
};
|
||||
|
||||
// Reverse read_command by reversing the schema version and transforming the slice from
|
||||
// the legacy reversed format to native reversed format. Shall be called with reversed
|
||||
// queries only.
|
||||
lw_shared_ptr<query::read_command> reversed(lw_shared_ptr<query::read_command>&& cmd);
|
||||
query::read_command reversed(query::read_command&& cmd);
|
||||
|
||||
struct mapreduce_request {
|
||||
enum class reduction_type {
|
||||
count,
|
||||
@@ -484,7 +490,7 @@ struct mapreduce_request {
|
||||
db::functions::function_name name;
|
||||
std::vector<sstring> column_names;
|
||||
};
|
||||
struct reductions_info {
|
||||
struct reductions_info {
|
||||
// Used by selector_factries to prepare reductions information
|
||||
std::vector<reduction_type> types;
|
||||
std::vector<aggregation_info> infos;
|
||||
|
||||
18
query.cc
18
query.cc
@@ -61,6 +61,24 @@ std::ostream& operator<<(std::ostream& out, const read_command& r) {
|
||||
return out;
|
||||
}
|
||||
|
||||
lw_shared_ptr<query::read_command> reversed(lw_shared_ptr<query::read_command>&& cmd)
|
||||
{
|
||||
auto schema = local_schema_registry().get(cmd->schema_version)->get_reversed();
|
||||
cmd->schema_version = schema->version();
|
||||
cmd->slice = query::legacy_reverse_slice_to_native_reverse_slice(*schema, cmd->slice);
|
||||
|
||||
return std::move(cmd);
|
||||
}
|
||||
|
||||
query::read_command reversed(query::read_command&& cmd)
|
||||
{
|
||||
auto schema = local_schema_registry().get(cmd.schema_version)->get_reversed();
|
||||
cmd.schema_version = schema->version();
|
||||
cmd.slice = query::legacy_reverse_slice_to_native_reverse_slice(*schema, cmd.slice);
|
||||
|
||||
return std::move(cmd);
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const mapreduce_request::reduction_type& r) {
|
||||
out << "reduction_type{";
|
||||
switch (r) {
|
||||
|
||||
Reference in New Issue
Block a user