From bfd13023117300ed2e5f83032dcac7567886eead Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sat, 29 Mar 2025 01:43:08 +0300 Subject: [PATCH] cql3: statement_restrictions: refine possible_lhs_values() function_call processing Currently, we are careful to call possible_lhs_values() for a token function only when slice/equality operators are used. We wish to relax this, so return nullptr (must filter) for the other cases instead of raising an internal error. --- cql3/restrictions/statement_restrictions.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cql3/restrictions/statement_restrictions.cc b/cql3/restrictions/statement_restrictions.cc index 569dd30c81..d0027cd37e 100644 --- a/cql3/restrictions/statement_restrictions.cc +++ b/cql3/restrictions/statement_restrictions.cc @@ -400,6 +400,10 @@ possible_lhs_values(const column_definition* cdef, if (cdef) { return [] (const query_options&) -> value_set { return unbounded_value_set; }; } + + if (!(oper.op == oper_t::EQ || is_slice(oper.op))) { + return nullptr; + } return [oper] (const query_options& options) -> value_set { auto val = evaluate(oper.rhs, options).to_managed_bytes_opt(); if (!val) { @@ -422,7 +426,7 @@ possible_lhs_values(const column_definition* cdef, } else if (oper.op == oper_t::LTE) { return interval::make_ending_with(interval_bound(std::move(adjusted_val), inclusive)); } - throw std::logic_error(format("get_token_interval invalid operator {}", oper.op)); + throw std::logic_error(format("get_token_interval unexpected operator {}", oper.op)); }; }, [&] (const binary_operator&) -> solve_for_t {