Skip to content

Commit

Permalink
Merge "Fix handling of contradicting token restrictions" from Tomasz
Browse files Browse the repository at this point in the history
  • Loading branch information
avikivity committed Jul 22, 2015
2 parents e416e80 + a71ac80 commit 45c5b0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 4 additions & 8 deletions cql3/restrictions/token_restriction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions tests/urchin/cql_query_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
});
});
Expand Down

0 comments on commit 45c5b0c

Please sign in to comment.