cql3: statement_restrictions: use tracked has_mc_clustering for _has_multi_column

Replace the two post-loop find_binop(_clustering_columns_restrictions,
is_multi_column) tree walks and the contains_multi_column_restriction()
tree walk with the already-tracked local has_mc_clustering.

The redundant second assignment inside the _check_indexes block is
removed entirely.
This commit is contained in:
Avi Kivity
2026-03-15 13:51:31 +02:00
parent da438507d0
commit 701366a8d1

View File

@@ -1536,21 +1536,20 @@ statement_restrictions::statement_restrictions(private_tag,
if (!has_token_restrictions()) {
_single_column_partition_key_restrictions = get_single_column_restrictions_map(_partition_key_restrictions);
}
if (!contains_multi_column_restriction(_clustering_columns_restrictions)) {
if (!has_mc_clustering) {
_single_column_clustering_key_restrictions = get_single_column_restrictions_map(_clustering_columns_restrictions);
}
_single_column_nonprimary_key_restrictions = get_single_column_restrictions_map(_nonprimary_key_restrictions);
_clustering_prefix_restrictions = extract_clustering_prefix_restrictions(_where, _schema);
_partition_range_restrictions = extract_partition_range(_where, _schema);
}
_has_multi_column = find_binop(_clustering_columns_restrictions, is_multi_column);
_has_multi_column = has_mc_clustering;
if (_check_indexes) {
auto cf = db.find_column_family(schema);
auto& sim = cf.get_index_manager();
const expr::allow_local_index allow_local(
!has_partition_key_unrestricted_components()
&& partition_key_restrictions_is_all_eq());
_has_multi_column = find_binop(_clustering_columns_restrictions, is_multi_column);
_has_queriable_ck_index = clustering_columns_restrictions_have_supporting_index(sim, allow_local)
&& !type.is_delete();
_has_queriable_pk_index = parition_key_restrictions_have_supporting_index(sim, allow_local)