From 5bf8807f9bffe58e2aa9f74f3e4048e4e1d09af0 Mon Sep 17 00:00:00 2001 From: Piotr Jastrzebski Date: Wed, 24 Aug 2016 19:21:07 +0200 Subject: [PATCH] Remove clustering_key_filtering_context::get_filter* These methods are not used any more so they can go away. Signed-off-by: Piotr Jastrzebski --- clustering_key_filter.cc | 39 +++++---------------------------------- clustering_key_filter.hh | 15 --------------- 2 files changed, 5 insertions(+), 49 deletions(-) diff --git a/clustering_key_filter.cc b/clustering_key_filter.cc index 47a3ac41c8..4352f65766 100644 --- a/clustering_key_filter.cc +++ b/clustering_key_filter.cc @@ -41,20 +41,10 @@ const clustering_key_filtering_context no_clustering_key_filtering = clustering_key_filtering_context::create_no_filtering(); class stateless_clustering_key_filter_factory : public clustering_key_filter_factory { - clustering_key_filter _filter; clustering_row_ranges _ranges; public: - stateless_clustering_key_filter_factory(clustering_row_ranges&& ranges, - clustering_key_filter&& filter) - : _filter(std::move(filter)), _ranges(std::move(ranges)) {} - - virtual clustering_key_filter get_filter(const partition_key& key) override { - return _filter; - } - - virtual clustering_key_filter get_filter_for_sorted(const partition_key& key) override { - return _filter; - } + stateless_clustering_key_filter_factory(clustering_row_ranges&& ranges) + : _ranges(std::move(ranges)) {} virtual const clustering_row_ranges& get_ranges(const partition_key& key) override { return _ranges; @@ -64,27 +54,10 @@ public: class partition_slice_clustering_key_filter_factory : public clustering_key_filter_factory { schema_ptr _schema; const partition_slice& _slice; - clustering_key_prefix::prefix_equal_tri_compare _cmp; clustering_row_ranges _ck_ranges; public: partition_slice_clustering_key_filter_factory(schema_ptr s, const partition_slice& slice) - : _schema(std::move(s)), _slice(slice), _cmp(*_schema) {} - - virtual clustering_key_filter get_filter(const partition_key& key) override { - const clustering_row_ranges& ranges = _slice.row_ranges(*_schema, key); - return [this, &ranges] (const clustering_key& key) { - return std::any_of(std::begin(ranges), std::end(ranges), - [this, &key] (const clustering_range& r) { return r.contains(key, _cmp); }); - }; - } - - virtual clustering_key_filter get_filter_for_sorted(const partition_key& key) override { - const clustering_row_ranges& ranges = _slice.row_ranges(*_schema, key); - return [this, &ranges] (const clustering_key& key) { - return std::any_of(std::begin(ranges), std::end(ranges), - [this, &key] (const clustering_range& r) { return r.contains(key, _cmp); }); - }; - } + : _schema(std::move(s)), _slice(slice) {} virtual const clustering_row_ranges& get_ranges(const partition_key& key) override { if (_slice.options.contains(query::partition_slice::option::reversed)) { @@ -104,11 +77,9 @@ create_partition_slice_filter(schema_ptr s, const partition_slice& slice) { const clustering_key_filtering_context clustering_key_filtering_context::create(schema_ptr schema, const partition_slice& slice) { static thread_local clustering_key_filtering_context accept_all = clustering_key_filtering_context( - ::make_shared(clustering_row_ranges{{}}, - [](const clustering_key&) { return true; })); + ::make_shared(clustering_row_ranges{{}})); static thread_local clustering_key_filtering_context reject_all = clustering_key_filtering_context( - ::make_shared(clustering_row_ranges{}, - [](const clustering_key&) { return false; })); + ::make_shared(clustering_row_ranges{})); if (slice.get_specific_ranges()) { return clustering_key_filtering_context(create_partition_slice_filter(schema, slice)); diff --git a/clustering_key_filter.hh b/clustering_key_filter.hh index d349696347..95a4de6654 100644 --- a/clustering_key_filter.hh +++ b/clustering_key_filter.hh @@ -34,16 +34,9 @@ namespace query { class partition_slice; -// A predicate that tells if a clustering key should be accepted. -using clustering_key_filter = std::function; - // A factory for clustering key filter which can be reused for multiple clustering keys. class clustering_key_filter_factory { public: - // Create a clustering key filter that can be used for multiple clustering keys with no restrictions. - virtual clustering_key_filter get_filter(const partition_key&) = 0; - // Create a clustering key filter that can be used for multiple clustering keys but they have to be sorted. - virtual clustering_key_filter get_filter_for_sorted(const partition_key&) = 0; virtual const std::vector>& get_ranges(const partition_key&) = 0; virtual ~clustering_key_filter_factory() = default; @@ -55,14 +48,6 @@ private: clustering_key_filtering_context() {}; clustering_key_filtering_context(shared_ptr factory) : _factory(factory) {} public: - // Create a clustering key filter that can be used for multiple clustering keys with no restrictions. - clustering_key_filter get_filter(const partition_key& key) const { - return _factory ? _factory->get_filter(key) : [] (const clustering_key&) { return true; }; - } - // Create a clustering key filter that can be used for multiple clustering keys but they have to be sorted. - clustering_key_filter get_filter_for_sorted(const partition_key& key) const { - return _factory ? _factory->get_filter_for_sorted(key) : [] (const clustering_key&) { return true; }; - } const std::vector>& get_ranges(const partition_key& key) const; static const clustering_key_filtering_context create(schema_ptr, const partition_slice&);