Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra Non-Counter Family

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?

like image 860
Dharun Avatar asked Oct 25 '13 18:10

Dharun


People also ask

What are counters Cassandra?

A counter is a special column for storing a number that is changed in increments. To load data into a counter column, or to increase or decrease the value of the counter, use the UPDATE command. Cassandra rejects USING TIMESTAMP or USING TTL in the command to update a counter column.

How many columns can Cassandra have?

Cassandra allows 2 billion columns per row.


2 Answers

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.

like image 74
Dharun Avatar answered Oct 19 '22 01:10

Dharun


Tables that contain counters can only contain counters.

like image 37
jbellis Avatar answered Oct 19 '22 02:10

jbellis