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.
This commit is contained in:
Avi Kivity
2025-03-29 01:43:08 +03:00
parent 736011b663
commit bfd1302311

View File

@@ -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<managed_bytes>::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 {