Re: Can I create a counter column family with many rows in 1.1.10?
What would be the exact CQL3 syntax to create a counter CF with composite row key and not predefined column names ? Is the following supposed to work ? CREATE TABLE composite_counter ( aid text, key1 text, key2 text, key3 text, value counter, PRIMARY KEY (aid, key1, key2, key3) ) First, when I do so I have no error shown, but I *can't* see this CF appear in my OpsCenter. update composite_counter set value = value + 5 where aid = '1' and key1 = 'test1' and key2 = 'test2' and key3 = 'test3'; works as expected too. But how can I have multiple counter columns using the schemaless property of cassandra ? I mean before, when I created counter CF with cli, things like this used to work: update composite_counter set 'value2' = 'value2' + 5 where aid = '1' and key1 = 'test1' and key2 = 'test2' and key3 = 'test3'; = Bad Request: line 1:29 no viable alternative at input 'value2' I also tried: update composite_counter set value2 = value2 + 5 where aid = '1' and key1 = 'test1' and key2 = 'test2' and key3 = 'test3'; = Bad Request: Unknown identifier value2 (as expected I guess) I want to make a counter CF with composite keys and a lot of counters using this pattern 20130306#event or (20130306, event), not sure if I should use composite columns there. Is it mandatory to create the CF with at least one column with the counter type ? I mean I will probably never use a column named 'value', I defined it just to be sure the CF is defined as a counter CF. 2013/3/6 Abhijit Chanda abhijit.chan...@gmail.com Thanks @aaron for the rectification On Wed, Mar 6, 2013 at 1:17 PM, aaron morton aa...@thelastpickle.comwrote: Note that CQL 3 in 1.1 is compatible with CQL 3 in 1.2. Also you do not have to use CQL 3, you can still use the cassandra-cli to create CF's. The syntax you use to populate it depends on the client you are using. Cheers - Aaron Morton Freelance Cassandra Developer New Zealand @aaronmorton http://www.thelastpickle.com On 5/03/2013, at 9:16 PM, Abhijit Chanda abhijit.chan...@gmail.com wrote: Yes you can , you just have to use CQL3 and 1.1.10 onward cassandra supports CQL3. Just you have to aware of the fact that a column family that contains a counter column can only contain counters. In other other words either all the columns of the column family excluding KEY have the counter type or none of them can have it. Best Regards, -- Abhijit Chanda +91-974395 -- Abhijit Chanda +91-974395
RE: Can I create a counter column family with many rows in 1.1.10?
Ah, I'ts with many columns, not rows. I use this in cql 2-3 create table cnt (key text PRIMARY KEY, y2003 counter, y2004 counter);it says this is not a counter column family, and if I try to use default_validation_class=CounterType,it says this is not a valid keyword.What I'm supposed to type in order to create it? From: aa...@thelastpickle.com Subject: Re: Can I create a counter column family with many rows in 1.1.10? Date: Tue, 5 Mar 2013 23:47:38 -0800 To: user@cassandra.apache.org Note that CQL 3 in 1.1 is compatible with CQL 3 in 1.2. Also you do not have to use CQL 3, you can still use the cassandra-cli to create CF's. The syntax you use to populate it depends on the client you are using. Cheers -Aaron MortonFreelance Cassandra DeveloperNew Zealand @aaronmortonhttp://www.thelastpickle.com On 5/03/2013, at 9:16 PM, Abhijit Chanda abhijit.chan...@gmail.com wrote:Yes you can , you just have to use CQL3 and 1.1.10 onward cassandra supports CQL3. Just you have to aware of the fact that a column family that contains a counter column can only contain counters. In other other words either all the columns of the column family excluding KEY have the counter type or none of them can have it. Best Regards, -- Abhijit Chanda +91-974395
RE: Can I create a counter column family with many rows in 1.1.10?
I got it now. From: mateus.ffrei...@hotmail.com To: user@cassandra.apache.org Subject: RE: Can I create a counter column family with many rows in 1.1.10? Date: Wed, 6 Mar 2013 08:42:37 -0300 Ah, I'ts with many columns, not rows. I use this in cql 2-3 create table cnt (key text PRIMARY KEY, y2003 counter, y2004 counter);it says this is not a counter column family, and if I try to use default_validation_class=CounterType,it says this is not a valid keyword.What I'm supposed to type in order to create it? From: aa...@thelastpickle.com Subject: Re: Can I create a counter column family with many rows in 1.1.10? Date: Tue, 5 Mar 2013 23:47:38 -0800 To: user@cassandra.apache.org Note that CQL 3 in 1.1 is compatible with CQL 3 in 1.2. Also you do not have to use CQL 3, you can still use the cassandra-cli to create CF's. The syntax you use to populate it depends on the client you are using. Cheers -Aaron MortonFreelance Cassandra DeveloperNew Zealand @aaronmortonhttp://www.thelastpickle.com On 5/03/2013, at 9:16 PM, Abhijit Chanda abhijit.chan...@gmail.com wrote:Yes you can , you just have to use CQL3 and 1.1.10 onward cassandra supports CQL3. Just you have to aware of the fact that a column family that contains a counter column can only contain counters. In other other words either all the columns of the column family excluding KEY have the counter type or none of them can have it. Best Regards, -- Abhijit Chanda +91-974395
Re: Can I create a counter column family with many rows in 1.1.10?
If you have one column in the table that is not part of the primary key and is a counter, then all columns that are not part of the primary key must also be a counter. Cheers - Aaron Morton Freelance Cassandra Developer New Zealand @aaronmorton http://www.thelastpickle.com On 6/03/2013, at 2:56 AM, Alain RODRIGUEZ arodr...@gmail.com wrote: What would be the exact CQL3 syntax to create a counter CF with composite row key and not predefined column names ? Is the following supposed to work ? CREATE TABLE composite_counter ( aid text, key1 text, key2 text, key3 text, value counter, PRIMARY KEY (aid, key1, key2, key3) ) First, when I do so I have no error shown, but I *can't* see this CF appear in my OpsCenter. update composite_counter set value = value + 5 where aid = '1' and key1 = 'test1' and key2 = 'test2' and key3 = 'test3'; works as expected too. But how can I have multiple counter columns using the schemaless property of cassandra ? I mean before, when I created counter CF with cli, things like this used to work: update composite_counter set 'value2' = 'value2' + 5 where aid = '1' and key1 = 'test1' and key2 = 'test2' and key3 = 'test3'; = Bad Request: line 1:29 no viable alternative at input 'value2' I also tried: update composite_counter set value2 = value2 + 5 where aid = '1' and key1 = 'test1' and key2 = 'test2' and key3 = 'test3'; = Bad Request: Unknown identifier value2 (as expected I guess) I want to make a counter CF with composite keys and a lot of counters using this pattern 20130306#event or (20130306, event), not sure if I should use composite columns there. Is it mandatory to create the CF with at least one column with the counter type ? I mean I will probably never use a column named 'value', I defined it just to be sure the CF is defined as a counter CF. 2013/3/6 Abhijit Chanda abhijit.chan...@gmail.com Thanks @aaron for the rectification On Wed, Mar 6, 2013 at 1:17 PM, aaron morton aa...@thelastpickle.com wrote: Note that CQL 3 in 1.1 is compatible with CQL 3 in 1.2. Also you do not have to use CQL 3, you can still use the cassandra-cli to create CF's. The syntax you use to populate it depends on the client you are using. Cheers - Aaron Morton Freelance Cassandra Developer New Zealand @aaronmorton http://www.thelastpickle.com On 5/03/2013, at 9:16 PM, Abhijit Chanda abhijit.chan...@gmail.com wrote: Yes you can , you just have to use CQL3 and 1.1.10 onward cassandra supports CQL3. Just you have to aware of the fact that a column family that contains a counter column can only contain counters. In other other words either all the columns of the column family excluding KEY have the counter type or none of them can have it. Best Regards, -- Abhijit Chanda +91-974395 -- Abhijit Chanda +91-974395
Re: Can I create a counter column family with many rows in 1.1.10?
Note that CQL 3 in 1.1 is compatible with CQL 3 in 1.2. Also you do not have to use CQL 3, you can still use the cassandra-cli to create CF's. The syntax you use to populate it depends on the client you are using. Cheers - Aaron Morton Freelance Cassandra Developer New Zealand @aaronmorton http://www.thelastpickle.com On 5/03/2013, at 9:16 PM, Abhijit Chanda abhijit.chan...@gmail.com wrote: Yes you can , you just have to use CQL3 and 1.1.10 onward cassandra supports CQL3. Just you have to aware of the fact that a column family that contains a counter column can only contain counters. In other other words either all the columns of the column family excluding KEY have the counter type or none of them can have it. Best Regards, -- Abhijit Chanda +91-974395
Re: Can I create a counter column family with many rows in 1.1.10?
Thanks @aaron for the rectification On Wed, Mar 6, 2013 at 1:17 PM, aaron morton aa...@thelastpickle.comwrote: Note that CQL 3 in 1.1 is compatible with CQL 3 in 1.2. Also you do not have to use CQL 3, you can still use the cassandra-cli to create CF's. The syntax you use to populate it depends on the client you are using. Cheers - Aaron Morton Freelance Cassandra Developer New Zealand @aaronmorton http://www.thelastpickle.com On 5/03/2013, at 9:16 PM, Abhijit Chanda abhijit.chan...@gmail.com wrote: Yes you can , you just have to use CQL3 and 1.1.10 onward cassandra supports CQL3. Just you have to aware of the fact that a column family that contains a counter column can only contain counters. In other other words either all the columns of the column family excluding KEY have the counter type or none of them can have it. Best Regards, -- Abhijit Chanda +91-974395 -- Abhijit Chanda +91-974395