From eee8f750cc7e783cf0be45eabcae1fbbb3df7aa9 Mon Sep 17 00:00:00 2001 From: Jan Ciolek Date: Wed, 1 Mar 2023 23:55:11 +0100 Subject: [PATCH] cql3: preserve binary_operator.order in search_and_replace There was a bug in `expr::search_and_replace`. It doesn't preserve the `order` field of binary_operator. `order` field is used to mark relations created using the SCYLLA_CLUSTERING_BOUND. It is a CQL feature used for internal queries inside Scylla. It means that we should handle the restriction as a raw clustering bound, not as an expression in the CQL language. Losing the SCYLLA_CLUSTERING_BOUND marker could cause issues, the database could end up selecting the wrong clustering ranges. Fixes: #13055 Signed-off-by: Jan Ciolek Closes #13056 (cherry picked from commit aa604bd935cc33ac9eec8c1088979b841c1ccc92) --- cql3/expr/expression.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cql3/expr/expression.cc b/cql3/expr/expression.cc index a270b90dfd..4169294697 100644 --- a/cql3/expr/expression.cc +++ b/cql3/expr/expression.cc @@ -1416,7 +1416,7 @@ expression search_and_replace(const expression& e, }; }, [&] (const binary_operator& oper) -> expression { - return binary_operator(recurse(oper.lhs), oper.op, recurse(oper.rhs)); + return binary_operator(recurse(oper.lhs), oper.op, recurse(oper.rhs), oper.order); }, [&] (const column_mutation_attribute& cma) -> expression { return column_mutation_attribute{cma.kind, recurse(cma.column)};