diff --git a/cql3/expr/expression.cc b/cql3/expr/expression.cc index b699a5f2b7..0175b60798 100644 --- a/cql3/expr/expression.cc +++ b/cql3/expr/expression.cc @@ -70,24 +70,12 @@ nested_expression::operator=(const nested_expression& o) { } binary_operator::binary_operator(expression lhs, oper_t op, ::shared_ptr rhs, comparison_order order) - : lhs(std::make_unique(std::move(lhs))) + : lhs(std::move(lhs)) , op(op) , rhs(std::move(rhs)) , order(order) { } -binary_operator::binary_operator(const binary_operator& x) : binary_operator(*x.lhs, x.op, x.rhs, x.order) { -} - -binary_operator& -binary_operator::operator=(const binary_operator& x) { - *lhs = *x.lhs; - op = x.op; - rhs = x.rhs; - order = x.order; - return *this; -} - // Since column_identifier_raw is forward-declared in expression.hh, delay destructor instantiation here unresolved_identifier::~unresolved_identifier() = default; @@ -913,7 +901,7 @@ bool is_on_collection(const binary_operator& b) { if (b.op == oper_t::CONTAINS || b.op == oper_t::CONTAINS_KEY) { return true; } - if (auto tuple = std::get_if(b.lhs.get())) { + if (auto tuple = std::get_if(&*b.lhs)) { return boost::algorithm::any_of(tuple->elements, [] (const column_value& v) { return v.sub; }); } return false; diff --git a/cql3/expr/expression.hh b/cql3/expr/expression.hh index 2fc5a9228d..182f7cbd4b 100644 --- a/cql3/expr/expression.hh +++ b/cql3/expr/expression.hh @@ -127,17 +127,12 @@ enum class comparison_order : char { /// Operator restriction: LHS op RHS. struct binary_operator { - std::unique_ptr lhs; + nested_expression lhs; oper_t op; ::shared_ptr rhs; comparison_order order; binary_operator(expression lhs, oper_t op, ::shared_ptr rhs, comparison_order order = comparison_order::cql); - - binary_operator(const binary_operator& x); - binary_operator& operator=(const binary_operator&); - binary_operator(binary_operator&& x) = default; - binary_operator& operator=(binary_operator&& x) = default; }; /// A conjunction of restrictions. diff --git a/cql3/restrictions/statement_restrictions.cc b/cql3/restrictions/statement_restrictions.cc index 6890f007d7..88ffadeb9e 100644 --- a/cql3/restrictions/statement_restrictions.cc +++ b/cql3/restrictions/statement_restrictions.cc @@ -690,7 +690,7 @@ dht::partition_range_vector partition_ranges_from_singles( size_t product_size = 1; for (const auto& e : expressions) { if (const auto arbitrary_binop = find_atom(e, [] (const binary_operator&) { return true; })) { - if (auto cv = std::get_if(arbitrary_binop->lhs.get())) { + if (auto cv = std::get_if(&*arbitrary_binop->lhs)) { const value_set vals = possible_lhs_values(cv->col, e, options); if (auto lst = std::get_if(&vals)) { if (lst->empty()) {