From ae7eb860a55a7e30af5f819e2aa06d2a3da3a9e0 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Tue, 12 May 2026 18:49:47 +0300 Subject: [PATCH] cql3: statement_restrictions: replace find_needs_filtering with predicate op check In the clustering prefix construction loop, replace the find_needs_filtering() call (which walks the merged predicate's expression tree looking for needs-filtering binary operators) with a check on the individual predicate vector. This uses the per-predicate op field directly instead of searching the expression tree. --- cql3/restrictions/statement_restrictions.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cql3/restrictions/statement_restrictions.cc b/cql3/restrictions/statement_restrictions.cc index 330f5f47cb..f91e598c00 100644 --- a/cql3/restrictions/statement_restrictions.cc +++ b/cql3/restrictions/statement_restrictions.cc @@ -1092,7 +1092,8 @@ statement_restrictions::statement_restrictions(private_tag, if (found == sc_ck_preds.end()) { break; } - if (find_needs_filtering(found->second.filter)) { + const auto& preds = sc_ck_pred_vectors[&col]; + if (std::ranges::any_of(preds, [](const predicate& p) { return p.op && needs_filtering(*p.op); })) { break; } prefix.push_back(found->second);