From dcdd2f7e72221957b1e4c8be3b641f33e7eebede Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 23 Oct 2024 12:58:12 +0300 Subject: [PATCH] cql3: statement_restrictions: push down clustering prefix wrapper one level This allows us to tackle each case separately. --- cql3/restrictions/statement_restrictions.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cql3/restrictions/statement_restrictions.cc b/cql3/restrictions/statement_restrictions.cc index 10a2bc655e..4e4e8e5170 100644 --- a/cql3/restrictions/statement_restrictions.cc +++ b/cql3/restrictions/statement_restrictions.cc @@ -2642,11 +2642,13 @@ query::clustering_range range_from_raw_bounds( get_clustering_bounds_fn_t statement_restrictions::build_get_clustering_bounds_fn() const { - return [&] (const query_options& options) -> std::vector { if (_clustering_prefix_restrictions.empty()) { + return [&] (const query_options& options) -> std::vector { return {query::clustering_range::make_open_ended_both_sides()}; + }; } if (find_binop(_clustering_prefix_restrictions[0], is_multi_column)) { + return [&] (const query_options& options) -> std::vector { bool all_natural = true, all_reverse = true; ///< Whether column types are reversed or natural. for (auto& r : _clustering_prefix_restrictions) { // TODO: move to constructor, do only once. using namespace expr; @@ -2678,10 +2680,12 @@ statement_restrictions::build_get_clustering_bounds_fn() const { } } return bounds; + }; } else { + return [&] (const query_options& options) -> std::vector { return get_single_column_clustering_bounds(options, *_schema, _clustering_prefix_restrictions); + }; } - }; } std::vector statement_restrictions::get_clustering_bounds(const query_options& options) const {