cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cody Yancey <yan...@uber.com>
Subject Re: Cannot mix counter and non counter columns in the same table
Date Tue, 01 Nov 2016 13:27:56 GMT
In your table schema, you have KEYS and you have VALUES. Your KEYS are
text, but they could be any non-counter type or compound thereof. KEYS
obviously cannot ever be counters.

Your VALUES, however, must be either all counters or all non-counters. The
official example you posted conforms to this limitation.

Thanks,
Cody

On Nov 1, 2016 7:16 AM, "Ali Akhtar" <ali.rac200@gmail.com> wrote:

> I'm not referring to the primary key, just to other columns.
>
> My primary key is a text, and my table contains a mix of texts, ints, and
> timestamps.
>
> If I try to change one of the ints to a counter and run the create table
> query, I get the error ' Cannot mix counter and non counter columns in
> the same table'
>
>
> On Tue, Nov 1, 2016 at 6:11 PM, Cody Yancey <yancey@uber.com> wrote:
>
>> For counter tables, non-counter types are of course allowed in the
>> primary key. Counters would be meaningless otherwise.
>>
>> Thanks,
>> Cody
>>
>> On Nov 1, 2016 7:00 AM, "Ali Akhtar" <ali.rac200@gmail.com> wrote:
>>
>>> In the documentation for counters:
>>>
>>> https://docs.datastax.com/en/cql/3.1/cql/cql_using/use_counter_t.html
>>>
>>> The example table is created via:
>>>
>>> CREATE TABLE counterks.page_view_counts
>>>   (counter_value counter,
>>>   url_name varchar,
>>>   page_name varchar,
>>>   PRIMARY KEY (url_name, page_name)
>>> );
>>>
>>> Yet if I try to create a table with a mixture of texts, ints,
>>> timestamps, and counters, i get the error ' Cannot mix counter and non
>>> counter columns in the same table'
>>>
>>> Is that supposed to be allowed or not allowed, given that the official
>>> example contains a mix of counters and non-counters?
>>>
>>
>

Mime
View raw message