Cassandra Non-Counter Family
Asked Answered
E

3

10

I'm attempted to execute the following CQL 3 statement

 CREATE TABLE summary (
                id uuid,
                "client" bigint, 
                "campaign" text, 
                "unit" bigint,
                "view" counter,
                PRIMARY KEY ("client", "campaign", "unit"));

The error I'm getting is that I cannot create a counter column on a non-counter column family.

Any ideas?

Export answered 25/10, 2013 at 18:3 Comment(0)
E
13

The solution to this issue is that any non-counter column must be part of the primary key. The column id uuid was the one causing the issue, removing it allowed the table to be created.

Export answered 27/10, 2013 at 17:27 Comment(0)
W
6

Tables that contain counters can only contain counters.

Whereat answered 25/10, 2013 at 20:10 Comment(2)
So it can have only counters and a single key?Export
multiple primary keys are accepted: docs.datastax.com/en/cql/3.0/cql/cql_using/use_counter_t.htmlMeilen
N
0

That's a limitation of the current counter implementation. You can't mix counters and regular columns in the same table. So you need a separate table for counters.

They are thinking of removing this limitation in Cassandra 3.x. See this Jira ticket.

(migrated from Cassandra non counter family)

Numerate answered 25/10, 2013 at 18:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.