From fbb4c9edda7f31bc2642f5af48dd4854bcc7a37a Mon Sep 17 00:00:00 2001 From: Duarte Nunes Date: Wed, 11 Oct 2017 14:39:59 +0000 Subject: [PATCH] schema: Provide all-selecting partition slice This patch introduces schema::full_slice(), which returns a partition_slice selecting the full clustering range, as well as all static and regular columns. No options aside from the default are set in that partition_slice. Signed-off-by: Duarte Nunes Message-Id: <1507732800-9448-1-git-send-email-duarte@scylladb.com> --- schema.cc | 2 ++ schema.hh | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/schema.cc b/schema.cc index 1a0224334a..9678a66476 100644 --- a/schema.cc +++ b/schema.cc @@ -34,6 +34,7 @@ #include #include #include "view_info.hh" +#include "partition_slice_builder.hh" constexpr int32_t schema::NAME_LENGTH; @@ -240,6 +241,7 @@ void schema::rebuild() { } _v3_columns = v3_columns::from_v2_schema(*this); + _full_slice = make_shared(partition_slice_builder(*this).build()); } const column_mapping& schema::get_column_mapping() const { diff --git a/schema.hh b/schema.hh index 0a09fcfa35..dbb00efa10 100644 --- a/schema.hh +++ b/schema.hh @@ -408,6 +408,10 @@ public: void apply_to(schema_builder&) const; }; +namespace query { +class partition_slice; +} + /* * Effectively immutable. * Not safe to access across cores because of shared_ptr's. @@ -481,6 +485,8 @@ private: lw_shared_ptr> _partition_key_type; lw_shared_ptr> _clustering_key_type; column_mapping _column_mapping; + shared_ptr _full_slice; + friend class schema_builder; public: using row_column_ids_are_ordered_by_name = std::true_type; @@ -713,6 +719,9 @@ public: bool is_view() const { return bool(_view_info); } + const query::partition_slice& full_slice() const { + return *_full_slice; + } // Returns all index names of this schema. std::vector index_names() const; // Returns all indices of this schema.