schema: rename column_mask to column_set

Since it contains a precise set of columns, it's more
accurate to call it a set, not a mask. Besides, the name
column_mask is already used for column options on storage
level.
This commit is contained in:
Konstantin Osipov
2019-11-12 22:15:34 +03:00
committed by Konstantin Osipov
parent 4a9b2a8d96
commit 191acec7ab
8 changed files with 17 additions and 17 deletions

View File

@@ -97,7 +97,7 @@ private:
// Cassandra returns a result set only if CAS succeeds. If
// any statement in the batch has IF EXISTS, we must return
// all columns of the table, including the primary key.
column_mask _columns_of_cas_result_set;
column_set _columns_of_cas_result_set;
cql_stats& _stats;
public:
/**

View File

@@ -82,7 +82,7 @@ std::optional<mutation> cas_request::apply_updates(api::timestamp_type ts) const
lw_shared_ptr<query::read_command> cas_request::read_command() const {
column_mask columns_to_read;
column_set columns_to_read;
std::vector<query::clustering_range> ranges;
for (const cas_row_update& op : _updates) {

View File

@@ -380,7 +380,7 @@ modification_statement::execute_with_condition(service::storage_proxy& proxy, se
seastar::shared_ptr<cql_transport::messages::result_message>
modification_statement::build_cas_result_set(seastar::shared_ptr<cql3::metadata> metadata,
const column_mask& columns,
const column_set& columns,
bool is_applied,
const update_parameters::prefetch_data& rows) {
@@ -393,7 +393,7 @@ modification_statement::build_cas_result_set(seastar::shared_ptr<cql3::metadata>
std::vector<bytes_opt> row;
row.reserve(metadata->value_count());
row.emplace_back(boolean_type->decompose(is_applied));
for (ordinal_column_id id = columns.find_first(); id != column_mask::npos; id = columns.find_next(id)) {
for (ordinal_column_id id = columns.find_first(); id != column_set::npos; id = columns.find_next(id)) {
const auto it = cell_map.cells.find(id);
if (it == cell_map.cells.end()) {
row.emplace_back(bytes_opt{});

View File

@@ -90,14 +90,14 @@ private:
// columns, to match Cassandra behaviour.
// This bitset contains a mask of ordinal_id identifiers
// of the required columns.
column_mask _columns_to_read;
column_set _columns_to_read;
// A CAS statement returns a result set with the columns
// used in condition expression. This is a mask of ordinal_id
// identifiers of the required columns. Contains all columns
// of a schema if we have IF EXISTS/IF NOT EXISTS. Does *not*
// contain LIST columns prefetched to apply updates, unless
// these columns are also used in conditions.
column_mask _columns_of_cas_result_set;
column_set _columns_of_cas_result_set;
public:
const schema_ptr s;
const std::unique_ptr<attributes> attrs;
@@ -201,7 +201,7 @@ public:
// CAS.
static seastar::shared_ptr<cql_transport::messages::result_message>
build_cas_result_set(seastar::shared_ptr<cql3::metadata> metadata,
const column_mask& mask, bool is_applied,
const column_set& mask, bool is_applied,
const update_parameters::prefetch_data& rows);
public:
virtual dht::partition_range_vector build_partition_keys(const query_options& options, const json_cache_opt& json_cache);
@@ -223,11 +223,11 @@ public:
bool requires_read() const { return _requires_read; }
// Columns used in this statement conditions or operations.
const column_mask& columns_to_read() const { return _columns_to_read; }
const column_set& columns_to_read() const { return _columns_to_read; }
// Columns of the statement result set (only CAS statement
// returns a result set).
const column_mask& columns_of_cas_result_set() { return _columns_of_cas_result_set; }
const column_set& columns_of_cas_result_set() { return _columns_of_cas_result_set; }
// Build a read_command instance to fetch the previous mutation from storage. The mutation is
// fetched if we need to check LWT conditions or apply updates to non-frozen list elements.

View File

@@ -168,7 +168,7 @@ public:
std::unique_ptr<specific_ranges> specific_ranges = nullptr,
cql_serialization_format = cql_serialization_format::internal(),
uint32_t partition_row_limit = max_rows);
partition_slice(clustering_row_ranges ranges, const schema& schema, const column_mask& mask, option_set options);
partition_slice(clustering_row_ranges ranges, const schema& schema, const column_set& mask, option_set options);
partition_slice(const partition_slice&);
partition_slice(partition_slice&&);
~partition_slice();

View File

@@ -125,11 +125,11 @@ partition_slice::partition_slice(clustering_row_ranges row_ranges,
, _partition_row_limit(partition_row_limit)
{}
partition_slice::partition_slice(clustering_row_ranges ranges, const schema& s, const column_mask& mask, option_set options)
partition_slice::partition_slice(clustering_row_ranges ranges, const schema& s, const column_set& columns, option_set options)
: partition_slice(ranges, query::column_id_vector{}, query::column_id_vector{}, options)
{
regular_columns.reserve(mask.count());
for (ordinal_column_id id = mask.find_first(); id != column_mask::npos; id = mask.find_next(id)) {
regular_columns.reserve(columns.count());
for (ordinal_column_id id = columns.find_first(); id != column_set::npos; id = columns.find_next(id)) {
const column_definition& def = s.column_at(id);
if (def.is_static()) {
static_columns.push_back(def.id);

View File

@@ -37,13 +37,13 @@
constexpr int32_t schema::NAME_LENGTH;
void column_mask::union_with(const column_mask& with) {
void column_set::union_with(const column_set& with) {
// boost::dynamic_bitset doesn't support logical
// or of bitsets of different sizes, work this around.
if (_mask.size() > with._mask.size()) {
if (with._mask.size()) {
column_mask::bitset tmp = with._mask;
column_set::bitset tmp = with._mask;
tmp.resize(_mask.size());
_mask |= tmp;
}

View File

@@ -58,7 +58,7 @@ std::ostream& operator<<(std::ostream& os, ordinal_column_id id);
// identified by ordinal_id.
//
// @sa column_definition::ordinal_id.
class column_mask {
class column_set {
public:
using bitset = boost::dynamic_bitset<uint64_t>;
using size_type = bitset::size_type;
@@ -94,7 +94,7 @@ public:
return static_cast<ordinal_column_id>(_mask.find_next(static_cast<column_count_type>(pos)));
}
// Logical or
void union_with(const column_mask& with);
void union_with(const column_set& with);
private:
bitset _mask;
};