From 79c6bb642ff575d71cfd17cd3b1c8dc37c02336b Mon Sep 17 00:00:00 2001 From: Nadav Har'El Date: Tue, 1 May 2018 15:15:42 +0300 Subject: [PATCH] secondary index: fix indexing of partition-key column Indexing an only partition key component is not allowed (because it would be redundant), but it should be allowed to index one of several partition key components. We had a bug in that case: the underlying materialized view we created had the same column as both a partition key and a clustering key, which resulted in an assertion failure. This patch fixes that. Fixes #3404. Signed-off-by: Nadav Har'El Message-Id: <20180501121544.22869-1-nyh@scylladb.com> --- index/secondary_index_manager.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index/secondary_index_manager.cc b/index/secondary_index_manager.cc index 0ab1bd06e6..0029799c8b 100644 --- a/index/secondary_index_manager.cc +++ b/index/secondary_index_manager.cc @@ -110,6 +110,9 @@ view_ptr secondary_index_manager::create_view_for_index(const index_metadata& im } builder.with_column(index_target->name(), index_target->type, column_kind::partition_key); for (auto& col : schema->partition_key_columns()) { + if (col == *index_target) { + continue; + } builder.with_column(col.name(), col.type, column_kind::clustering_key); } for (auto& col : schema->clustering_key_columns()) {