mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 01:50:35 +00:00
cql3: statement_restrictions: make get_multi_column_clustering_bounds a builder
Lay the groundwork for analyzing multi column clustering bounds by splitting the function into prepare-time and execute-time parts. To start with, all of the work is done at query time, but later patches will move bits into prepare time.
This commit is contained in:
@@ -2370,11 +2370,12 @@ std::vector<query::clustering_range> get_equivalent_ranges(
|
||||
const query::clustering_range& cql_order_range, const schema& schema);
|
||||
|
||||
/// Calculates clustering bounds for the multi-column case.
|
||||
std::vector<query::clustering_range> get_multi_column_clustering_bounds(
|
||||
const query_options& options,
|
||||
std::function<std::vector<query::clustering_range> (const query_options&)>
|
||||
build_get_multi_column_clustering_bounds_fn(
|
||||
schema_ptr schema,
|
||||
const std::vector<predicate>& multi_column_restrictions,
|
||||
bool all_natural, bool all_reverse) {
|
||||
return [schema, multi_column_restrictions, all_natural, all_reverse] (const query_options& options) -> std::vector<query::clustering_range> {
|
||||
multi_column_range_accumulator acc{options, schema};
|
||||
for (const auto& restr : multi_column_restrictions | std::views::transform(&predicate::filter)) {
|
||||
expr::visit(acc, restr);
|
||||
@@ -2395,6 +2396,7 @@ std::vector<query::clustering_range> get_multi_column_clustering_bounds(
|
||||
}
|
||||
}
|
||||
return bounds;
|
||||
};
|
||||
}
|
||||
|
||||
/// Reverses the range if the type is reversed. Why don't we have interval::reverse()??
|
||||
@@ -2736,10 +2738,8 @@ statement_restrictions::build_get_clustering_bounds_fn() const {
|
||||
}
|
||||
}
|
||||
}
|
||||
return [this, all_natural, all_reverse] (const query_options& options) -> std::vector<query::clustering_range> {
|
||||
return get_multi_column_clustering_bounds(options, _schema, _clustering_prefix_restrictions,
|
||||
return build_get_multi_column_clustering_bounds_fn(_schema, _clustering_prefix_restrictions,
|
||||
all_natural, all_reverse);
|
||||
};
|
||||
} else {
|
||||
return [&] (const query_options& options) -> std::vector<query::clustering_range> {
|
||||
return get_single_column_clustering_bounds(options, *_schema, _clustering_prefix_restrictions);
|
||||
|
||||
Reference in New Issue
Block a user