diff --git a/cql3/restrictions/token_restriction.hh b/cql3/restrictions/token_restriction.hh index 485ae1affd..4a634cefb1 100644 --- a/cql3/restrictions/token_restriction.hh +++ b/cql3/restrictions/token_restriction.hh @@ -95,15 +95,11 @@ public: * * In practice, we want to return an empty result set if either startToken > endToken, or both are equal but * one of the bound is excluded (since [a, a] can contains something, but not (a, a], [a, a) or (a, a)). - * Note though that in the case where startToken or endToken is the minimum token, then this special case - * rule should not apply. */ - if (start_token.is_minimum() - && end_token.is_maximum() - && (start_token > end_token - || (start_token == end_token - && (!include_start || !include_end)))) { - return {query::partition_range::make_open_ended_both_sides()}; + if (start_token > end_token + || (start_token == end_token + && (!include_start || !include_end))) { + return {}; } typedef typename bounds_range_type::bound bound; diff --git a/tests/urchin/cql_query_test.cc b/tests/urchin/cql_query_test.cc index ee6c930742..42db8a2798 100644 --- a/tests/urchin/cql_query_test.cc +++ b/tests/urchin/cql_query_test.cc @@ -591,6 +591,14 @@ SEASTAR_TEST_CASE(test_partition_range_queries_with_bounds) { {keys[3]} }); }); + }).then([keys, tokens, &e] { + return e.execute_cql(sprint("select k from cf where token(k) < 0x%s and token(k) > 0x%s;", to_hex(tokens[3]), to_hex(tokens[3]))).then([keys](auto msg) { + assert_that(msg).is_rows().is_empty(); + }); + }).then([keys, tokens, &e] { + return e.execute_cql(sprint("select k from cf where token(k) >= 0x%s and token(k) <= 0x%s;", to_hex(tokens[4]), to_hex(tokens[2]))).then([keys](auto msg) { + assert_that(msg).is_rows().is_empty(); + }); }); }); });