Merge "Fix handling of contradicting token restrictions" from Tomasz

This commit is contained in:
Avi Kivity
2015-07-22 19:47:49 +03:00
2 changed files with 12 additions and 8 deletions

View File

@@ -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;

View File

@@ -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();
});
});
});
});