mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 10:00:35 +00:00
test: cql: Add test for results order with variable length keys
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "cql3/query_options.hh"
|
||||
#include "core/distributed.hh"
|
||||
#include "tests/test-utils.hh"
|
||||
#include "tests/urchin/cql_test_env.hh"
|
||||
|
||||
struct conversation_state {
|
||||
service::storage_proxy proxy;
|
||||
@@ -420,6 +421,34 @@ SEASTAR_TEST_CASE(test_range_queries) {
|
||||
});
|
||||
}
|
||||
|
||||
SEASTAR_TEST_CASE(test_ordering_of_composites_with_variable_length_components) {
|
||||
return do_with_cql_env([] (auto& e) {
|
||||
return e.create_table([](auto ks) {
|
||||
return schema(ks, "cf",
|
||||
{{"k", bytes_type}},
|
||||
// We need more than one clustering column so that the single-element tuple format optimisation doesn't kick in
|
||||
{{"c0", bytes_type}, {"c1", bytes_type}},
|
||||
{{"v", bytes_type}},
|
||||
{},
|
||||
utf8_type);
|
||||
}).then([&e] {
|
||||
return e.execute_cql("update cf set v = 0x01 where k = 0x00 and c0 = 0x0001 and c1 = 0x00;").discard_result();
|
||||
}).then([&e] {
|
||||
return e.execute_cql("update cf set v = 0x02 where k = 0x00 and c0 = 0x03 and c1 = 0x00;").discard_result();
|
||||
}).then([&e] {
|
||||
return e.execute_cql("update cf set v = 0x03 where k = 0x00 and c0 = 0x035555 and c1 = 0x00;").discard_result();
|
||||
}).then([&e] {
|
||||
return e.execute_cql("update cf set v = 0x04 where k = 0x00 and c0 = 0x05 and c1 = 0x00;").discard_result();
|
||||
}).then([&e] {
|
||||
return e.execute_cql("select v from cf where k = 0x00 allow filtering;").then([](auto msg) {
|
||||
assert_that(msg).is_rows().with_rows({
|
||||
{from_hex("01")}, {from_hex("02")}, {from_hex("03")}, {from_hex("04")}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
SEASTAR_TEST_CASE(test_map_insert_update) {
|
||||
auto db = make_shared<distributed<database>>();
|
||||
auto state = make_shared<conversation_state>(*db, ks_name);
|
||||
|
||||
@@ -111,3 +111,13 @@ future<::shared_ptr<cql_test_env>> make_env_for_test() {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
template <typename Func>
|
||||
static inline
|
||||
future<> do_with_cql_env(Func&& func) {
|
||||
return make_env_for_test().then([func = std::forward<Func>(func)] (auto e) {
|
||||
return func(*e).finally([e] {
|
||||
return e->stop().finally([e] {});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user