Ok. I am able to understand the problem now. Issue is: If i create a column family altercations as:
**********************************************************************************************************8 CREATE TABLE altercations ( instigator text, started_at timestamp, ships_destroyed int, energy_used float, alliance_involvement boolean, PRIMARY KEY (instigator,started_at,ships_destroyed) ); / INSERT INTO altercations (instigator, started_at, ships_destroyed, energy_used, alliance_involvement) VALUES ('Jayne Cobb', '2012-07-23', 2, 4.6, 'false'); ********************************************************************************************************************* it works! But if i create a column family with compound primary key with 2 composite column as: CREATE TABLE altercations ( instigator text, started_at timestamp, ships_destroyed int, energy_used float, alliance_involvement boolean, PRIMARY KEY (instigator,started_at) ); ********************************************************************************************************************* and Then drop this column family: drop columnfamily altercations; and then try to create same one with primary compound key with 3 composite column: CREATE TABLE altercations ( instigator text, started_at timestamp, ships_destroyed int, energy_used float, alliance_involvement boolean, PRIMARY KEY (instigator,started_at,ships_destroyed) ); it gives me error: "TSocket read 0 bytes" Rest, as no column family is created, so nothing onwards will work. Is this an issue? -Vivek On Tue, Oct 9, 2012 at 8:42 AM, Vivek Mishra <mishra.v...@gmail.com> wrote: > Hi Brian, > Thanks for these references. These will surly help as i am on my way to > get them integrate with-in Kundera. > > Surprisingly Column family itself was not created with example i was > trying. > > Thanks again, > -Vivek > > On Tue, Oct 9, 2012 at 8:33 AM, Brian O'Neill <b...@alumni.brown.edu>wrote: > >> Hey Vivek, >> >> The same thing happened to me the other day. You may be missing a >> component in your compound key. >> >> See this thread: >> >> http://mail-archives.apache.org/mod_mbox/cassandra-dev/201210.mbox/%3ccajhhpg20rrcajqjdnf8sf7wnhblo6j+aofksgbxyxwcoocg...@mail.gmail.com%3E >> >> I also wrote a couple blogs on it: >> >> http://brianoneill.blogspot.com/2012/09/composite-keys-connecting-dots-between.html >> >> http://brianoneill.blogspot.com/2012/10/cql-astyanax-and-compoundcomposite-keys.html >> >> They've fixed this in the 1.2 beta, whereby it checks (at the thrift >> layer) to ensure you have the requisite number of components in the >> compound/composite key. >> >> -brian >> >> >> On Oct 8, 2012, at 10:32 PM, Vivek Mishra wrote: >> >> Certainly. As these are available with cql3 only! >> Example mentioned on datastax website is working fine, only difference is >> i tried with a compound primary key with 3 composite columns in place of 2 >> >> -Vivek >> >> On Tue, Oct 9, 2012 at 7:57 AM, Arindam Barua <aba...@247-inc.com> wrote: >> >>> ** ** >>> >>> Did you use the “--cql3” option with the cqlsh command?**** >>> >>> ** ** >>> >>> *From:* Vivek Mishra [mailto:mishra.v...@gmail.com] >>> *Sent:* Monday, October 08, 2012 7:22 PM >>> *To:* user@cassandra.apache.org >>> >>> *Subject:* Using compound primary key**** >>> >>> ** ** >>> >>> Hi,**** >>> >>> ** ** >>> >>> I am trying to use compound primary key column name and i am referring >>> to:**** >>> >>> http://www.datastax.com/dev/blog/whats-new-in-cql-3-0**** >>> >>> ** ** >>> >>> As mentioned on this example, i tried to create a column family >>> containing compound primary key (one or more) as:**** >>> >>> ** ** >>> >>> CREATE TABLE altercations (**** >>> >>> instigator text,**** >>> >>> started_at timestamp,**** >>> >>> ships_destroyed int,**** >>> >>> energy_used float,**** >>> >>> alliance_involvement boolean,**** >>> >>> PRIMARY KEY (instigator,started_at,ships_destroyed)**** >>> >>> );**** >>> >>> ** ** >>> >>> And i am getting:**** >>> >>> ** ** >>> >>> ************************************************************************ >>> ** >>> >>> TSocket read 0 bytes**** >>> >>> cqlsh:testcomp> **** >>> >>> ************************************************************************ >>> ** >>> >>> ** ** >>> >>> ** ** >>> >>> Then followed by insert and select statements giving me following errors: >>> **** >>> >>> ** ** >>> >>> >>> ******************************************************************************************************************************************** >>> **** >>> >>> ** ** >>> >>> cqlsh:testcomp> INSERT INTO altercations (instigator, started_at, >>> ships_destroyed,**** >>> >>> ... energy_used, >>> alliance_involvement)**** >>> >>> ... VALUES ('Jayne Cobb', '2012-07-23', >>> 2, 4.6, 'false');**** >>> >>> TSocket read 0 bytes**** >>> >>> ** ** >>> >>> cqlsh:testcomp> select * from altercations;**** >>> >>> Traceback (most recent call last):**** >>> >>> File "bin/cqlsh", line 1008, in perform_statement**** >>> >>> self.cursor.execute(statement, decoder=decoder)**** >>> >>> File >>> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", line >>> 117, in execute**** >>> >>> response = self.handle_cql_execution_errors(doquery, prepared_q, >>> compress)**** >>> >>> File >>> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cursor.py", line >>> 132, in handle_cql_execution_errors**** >>> >>> return executor(*args, **kwargs)**** >>> >>> File >>> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py", >>> line 1583, in execute_cql_query**** >>> >>> self.send_execute_cql_query(query, compression)**** >>> >>> File >>> "bin/../lib/cql-internal-only-1.0.10.zip/cql-1.0.10/cql/cassandra/Cassandra.py", >>> line 1593, in send_execute_cql_query**** >>> >>> self._oprot.trans.flush()**** >>> >>> File >>> "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TTransport.py", >>> line 293, in flush**** >>> >>> self.__trans.write(buf)**** >>> >>> File >>> "bin/../lib/thrift-python-internal-only-0.7.0.zip/thrift/transport/TSocket.py", >>> line 117, in write**** >>> >>> plus = self.handle.send(buff)**** >>> >>> error: [Errno 32] Broken pipe**** >>> >>> ** ** >>> >>> cqlsh:testcomp> **** >>> >>> ** ** >>> >>> >>> ******************************************************************************************************************************************** >>> **** >>> >>> ** ** >>> >>> ** ** >>> >>> ** ** >>> >>> Any idea? Is it a problem with CQL3 or with cassandra?**** >>> >>> ** ** >>> >>> P.S: I did post same query on dev group as well to get a quick response. >>> **** >>> >>> ** ** >>> >>> ** ** >>> >>> -Vivek**** >>> >> >> >> -- >> Brian ONeill >> Lead Architect, Health Market Science (http://healthmarketscience.com) >> mobile:215.588.6024 >> blog: http://weblogs.java.net/blog/boneill42/ >> blog: http://brianoneill.blogspot.com/ >> >> >