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
________________________________
From: Jonathan Ellis <[email protected]>
To: [email protected]; Vivek Mishra <[email protected]>
Sent: Tuesday, October 9, 2012 9:08 AM
Subject: Re: Compund/Composite column names
Works for me on latest 1.1 in cql3 mode. cql2 mode gives a parse error.
On Mon, Oct 8, 2012 at 9:18 PM, Vivek Mishra <[email protected]> wrote:
> Hi All,
>
> 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?
>
>
> -Vivek
--
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com