view: fix bug in virtual columns.
When creating a virtual column of non-frozen map type, the wrong type was used for the map's keys. Fixes #5165.
This commit is contained in:
committed by
Nadav Har'El
parent
f12feec2c9
commit
ef9d5750c8
@@ -455,7 +455,7 @@ void create_virtual_column(schema_builder& builder, const bytes& name, const dat
|
||||
// A map has keys and values. We don't need these values,
|
||||
// and can use empty values instead.
|
||||
auto mtype = dynamic_pointer_cast<const map_type_impl>(type);
|
||||
builder.with_column(name, map_type_impl::get_instance(mtype->get_values_type(), empty_type, true), column_kind::regular_column, column_view_virtual::yes);
|
||||
builder.with_column(name, map_type_impl::get_instance(mtype->get_keys_type(), empty_type, true), column_kind::regular_column, column_view_virtual::yes);
|
||||
} else if (ctype->is_set()) {
|
||||
// A set's cell has nothing beyond the keys, so the
|
||||
// virtual version of a set is, unfortunately, a complete
|
||||
|
||||
@@ -515,7 +515,7 @@ SEASTAR_TEST_CASE(test_update_column_not_in_view_with_flush) {
|
||||
}
|
||||
|
||||
void test_partial_update_with_unselected_collections(cql_test_env& e, std::function<void()>&& maybe_flush) {
|
||||
e.execute_cql("create table cf (p int, c int, a int, b int, l list<int>, s set<int>, m map<int,int>, primary key (p, c))").get();
|
||||
e.execute_cql("create table cf (p int, c int, a int, b int, l list<int>, s set<int>, m map<int,text>, primary key (p, c))").get();
|
||||
e.execute_cql("create materialized view vcf as select a, b from cf "
|
||||
"where p is not null and c is not null "
|
||||
"primary key (c, p)").get();
|
||||
@@ -563,7 +563,7 @@ e.execute_cql("create table cf (p int, c int, a int, b int, l list<int>, s set<i
|
||||
assert_that(msg).is_rows().is_empty();
|
||||
});
|
||||
|
||||
e.execute_cql("update cf set m=m+{3:3}, l=l-[1], s=s-{2} where p = 1 and c = 1").get();
|
||||
e.execute_cql("update cf set m=m+{3:'text'}, l=l-[1], s=s-{2} where p = 1 and c = 1").get();
|
||||
maybe_flush();
|
||||
eventually([&] {
|
||||
auto msg = e.execute_cql("select * from vcf").get0();
|
||||
|
||||
Reference in New Issue
Block a user