diff --git a/cql3/restrictions/single_column_restrictions.hh b/cql3/restrictions/single_column_restrictions.hh index 3590917c9570..b9881a6ba51b 100644 --- a/cql3/restrictions/single_column_restrictions.hh +++ b/cql3/restrictions/single_column_restrictions.hh @@ -108,6 +108,9 @@ public: return bytes_opt{}; } else { const auto values = std::get(possible_lhs_values(&cdef, it->second->expression, options)); + if (values.empty()) { + return bytes_opt{}; + } assert(values.size() == 1); return values.front(); } diff --git a/test/boost/secondary_index_test.cc b/test/boost/secondary_index_test.cc index a08d27e94048..18473d2e0675 100644 --- a/test/boost/secondary_index_test.cc +++ b/test/boost/secondary_index_test.cc @@ -76,6 +76,14 @@ SEASTAR_TEST_CASE(test_secondary_index_clustering_key_query) { { utf8_type->decompose(sstring("dcurrorw@techcrunch.com")) }, { utf8_type->decompose(sstring("beassebyv@house.gov")) }, }); + }).then([&e] { + return e.execute_cql("select country from users where country='France' and country='Denmark'"); // #7772 + }).then([&e] (shared_ptr msg) { + assert_that(msg).is_rows().is_empty(); + }).then([&e] { + return e.execute_cql("select country from users where country='Denmark' and country='Denmark'"); + }).then([&e] (shared_ptr msg) { + assert_that(msg).is_rows().with_rows({{utf8_type->decompose(sstring("Denmark"))}}); }); }); }