Hi Michael, CASSANDRA-9928 <https://issues.apache.org/jira/browse/CASSANDRA-9928> has open discussion . And our use case is also similar to the follow ups mentioned in this jira. We update all columns together which are used in MV key.
--------------------------------------------------------------------------------------------------------------------- Atul Saroha *Lead Software Engineer* *M*: +91 8447784271 *T*: +91 124-415-6069 *EXT*: 12369 Plot # 362, ASF Centre - Tower A, Udyog Vihar, Phase -4, Sector 18, Gurgaon, Haryana 122016, INDIA On Tue, Jun 21, 2016 at 11:41 PM, Michael Mior <mm...@uwaterloo.ca> wrote: > It turns out this behaviour was not intended to be allowed and > constructing MVs like this can lead to issues. See > https://issues.apache.org/jira/browse/CASSANDRA-9928 > > -- > Michael Mior > michael.m...@gmail.com > > 2016-06-21 7:32 GMT-04:00 Atul Saroha <atul.sar...@snapdeal.com>: > >> There is behavioural difference between 3.0.3 and (3.0.7/3.7) for below >> schema in materialized view. >> >> >> CREATE TABLE ks.pa ( >>> id bigint, >>> sub_id text, >>> name text, >>> class text, >>> r_id bigint, >>> k_id bigint, >>> created timestamp, >>> priority int, >>> updated timestamp, >>> value text, >>> PRIMARY KEY (id, sub_id, name) >>> ); >>> >>> CREATE ks.mv_pa AS >>> SELECT k_id, name, value, sub_id, id, class, r_id >>> FROM ks.pa >>> WHERE k_id IS NOT NULL AND name IS NOT NULL AND value IS NOT NULL >>> AND sub_id IS NOT NULL AND id IS NOT NULL >>> PRIMARY KEY ((k_id, name), value, sub_id, id); >>> >> >> We were able to create below MV in 3.0.3 but it fails in 3.0.7/3.7 with >> following error >> >> InvalidRequest: code=2200 [Invalid query] message="Cannot include more >>> than one non-primary key column 'value' in materialized view partition key" >>> >> >> We are not able to upgrade it. Also "value" is clustering key and "k_id" >> is in partition key. Thus, there is only one non-primary key column from >> main table in partition key. Then why we are getting this error in >> 3.0.7/3.7 cassandra. >> >> Help will be appreciated. >> >> >> >> --------------------------------------------------------------------------------------------------------------------- >> Atul Saroha >> *Lead Software Engineer* >> *M*: +91 8447784271 *T*: +91 124-415-6069 *EXT*: 12369 >> Plot # 362, ASF Centre - Tower A, Udyog Vihar, >> Phase -4, Sector 18, Gurgaon, Haryana 122016, INDIA >> > >