You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Shahryar Sedghi <sh...@gmail.com> on 2013/01/12 18:48:19 UTC

Cassandra 1.2 Thrift and CQL 3 issue

Hi

I am trying to test my application that runs with JDBC, CQL 3 with
Cassandra 1.2. After getting many weird errors and downgrading from JDBC to
thrift, I realized the thrift on Cassandra 1.2 has issues with wide rows.
If I define the table as:

CREATE TABLE  test(interval int,id text, body text, primary key (interval,
id));

select interval, id, body from test;

 fails with:

ERROR [Thrift:16] 2013-01-11 18:23:35,997 CustomTThreadPoolServer.java
(line 217) Error occurred during processing of message.
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
    at
org.apache.cassandra.config.CFMetaData.getColumnDefinitionFromColumnName(CFMetaData.java:923)
    at
org.apache.cassandra.cql.QueryProcessor.processStatement(QueryProcessor.java:502)
    at
org.apache.cassandra.cql.QueryProcessor.process(QueryProcessor.java:789)
    at
org.apache.cassandra.thrift.CassandraServer.execute_cql_query(CassandraServer.java:1652)
    at
org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4048)
    at
org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4036)
    at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
    at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
    at
org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1121)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
    at java.lang.Thread.run(Thread.java:780)

Same code works well with Cassandra 1.1.

At the same time, if I define the table as:
CREATE TABLE  test1(interval int,id text, body text, primary key
(interval));

everything works fine. I am using

DataStax Community 1.2

apache-cassandra-clientutil-1.2.0.jar
apache-cassandra-thrift-1.2.0.jar
libthrift-0.7.0.jar

Apparently client.set_cql_version("3.0.0"); has no effect either. Is there
a setting that I miss on the client side to dictate cql3 or it is a bug?

Thanks in advance

Shahryar

-- 
"Life is what happens while you are making other plans." ~ John Lennon

Re: Cassandra 1.2 Thrift and CQL 3 issue

Posted by Brian O'Neill <bo...@alumni.brown.edu>.
I reported the issue here.  You may be missing a component in your column name.

https://issues.apache.org/jira/browse/CASSANDRA-5138

-brian


On Jan 12, 2013, at 12:48 PM, Shahryar Sedghi wrote:

> Hi
> 
> I am trying to test my application that runs with JDBC, CQL 3 with Cassandra 1.2. After getting many weird errors and downgrading from JDBC to thrift, I realized the thrift on Cassandra 1.2 has issues with wide rows. If I define the table as:
> 
> CREATE TABLE  test(interval int,id text, body text, primary key (interval, id));
> 
> select interval, id, body from test;
> 
>  fails with:
> 
> ERROR [Thrift:16] 2013-01-11 18:23:35,997 CustomTThreadPoolServer.java (line 217) Error occurred during processing of message.
> java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
>     at org.apache.cassandra.config.CFMetaData.getColumnDefinitionFromColumnName(CFMetaData.java:923)
>     at org.apache.cassandra.cql.QueryProcessor.processStatement(QueryProcessor.java:502)
>     at org.apache.cassandra.cql.QueryProcessor.process(QueryProcessor.java:789)
>     at org.apache.cassandra.thrift.CassandraServer.execute_cql_query(CassandraServer.java:1652)
>     at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4048)
>     at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4036)
>     at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
>     at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
>     at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
>     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1121)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
>     at java.lang.Thread.run(Thread.java:780)
> 
> Same code works well with Cassandra 1.1. 
> 
> At the same time, if I define the table as:
> CREATE TABLE  test1(interval int,id text, body text, primary key (interval));
> 
> everything works fine. I am using 
> 
> DataStax Community 1.2
> 
> apache-cassandra-clientutil-1.2.0.jar
> apache-cassandra-thrift-1.2.0.jar
> libthrift-0.7.0.jar
> 
> Apparently client.set_cql_version("3.0.0"); has no effect either. Is there a setting that I miss on the client side to dictate cql3 or it is a bug?
> 
> Thanks in advance
> 
> Shahryar
> 
> -- 
> "Life is what happens while you are making other plans." ~ John Lennon

-- 
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/


Re: Cassandra 1.2 Thrift and CQL 3 issue

Posted by Vivek Mishra <mi...@gmail.com>.
If you want the "row key", just query it (we prefer the term "partition
key" in CQL3 and that's the term you'll find in documents like
http://cassandra.apache.org/doc/cql3/CQL.html but it's the same thing) and
it'll be part of the return columns.

I understand that, as i am able to fetch "partition key" and "clustering
key" for composite Key. Wondering even if it is a partition key, shouldn't
it be returned in form of "key" rather than as part of returned columns?
Bit confusing,  as definition of column in cassandra is {column_name,
column_value, timestamp}. Is it true for partition key as well?

-Vivek




On Mon, Jan 14, 2013 at 7:43 PM, Sylvain Lebresne <sy...@datastax.com>wrote:

> How to fetch and populate  "row key"  from CqlRow api then?
>
>
> If you want the "row key", just query it (we prefer the term "partition
> key" in CQL3 and that's the term you'll find in documents like
> http://cassandra.apache.org/doc/cql3/CQL.html but it's the same thing)
> and it'll be part of the return columns.
>
> --
> Sylvain
>
>
>>
>> -Vivek
>>
>>
>> On Mon, Jan 14, 2013 at 7:18 PM, Sylvain Lebresne <sy...@datastax.com>wrote:
>>
>>> On Mon, Jan 14, 2013 at 12:48 PM, Vivek Mishra <mi...@gmail.com>wrote:
>>>
>>>> I am getting an issue, where "key" attribute's in byte[] is returned as
>>>> empty value.
>>>>
>>>
>>> We don't return this anymore as this doesn't make much sense for CQL3.
>>> Same as in CqlMetadata we don't return a default_name_type and
>>> default_value_type as they don't make any sense anymore either (they still
>>> exist in the thrift struct for compatibility sake, CQL2 still uses them,
>>> and we figured it was not worth duplicating thing by creating a specific
>>> Cql3Result struct).
>>>
>>> --
>>> Sylvain
>>>
>>>
>>>> Though same is working with 1.1.6
>>>>
>>>> -Vivek
>>>>
>>>>
>>>>
>>>> On Mon, Jan 14, 2013 at 4:34 PM, Sylvain Lebresne <sylvain@datastax.com
>>>> > wrote:
>>>>
>>>>> methods
>>>>
>>>>
>>>>
>>>>
>>>
>>
>

Re: Cassandra 1.2 Thrift and CQL 3 issue

Posted by Sylvain Lebresne <sy...@datastax.com>.
>
> How to fetch and populate  "row key"  from CqlRow api then?


If you want the "row key", just query it (we prefer the term "partition
key" in CQL3 and that's the term you'll find in documents like
http://cassandra.apache.org/doc/cql3/CQL.html but it's the same thing) and
it'll be part of the return columns.

--
Sylvain


>
> -Vivek
>
>
> On Mon, Jan 14, 2013 at 7:18 PM, Sylvain Lebresne <sy...@datastax.com>wrote:
>
>> On Mon, Jan 14, 2013 at 12:48 PM, Vivek Mishra <mi...@gmail.com>wrote:
>>
>>> I am getting an issue, where "key" attribute's in byte[] is returned as
>>> empty value.
>>>
>>
>> We don't return this anymore as this doesn't make much sense for CQL3.
>> Same as in CqlMetadata we don't return a default_name_type and
>> default_value_type as they don't make any sense anymore either (they still
>> exist in the thrift struct for compatibility sake, CQL2 still uses them,
>> and we figured it was not worth duplicating thing by creating a specific
>> Cql3Result struct).
>>
>> --
>> Sylvain
>>
>>
>>> Though same is working with 1.1.6
>>>
>>> -Vivek
>>>
>>>
>>>
>>> On Mon, Jan 14, 2013 at 4:34 PM, Sylvain Lebresne <sy...@datastax.com>wrote:
>>>
>>>> methods
>>>
>>>
>>>
>>>
>>
>

Re: Cassandra 1.2 Thrift and CQL 3 issue

Posted by Vivek Mishra <mi...@gmail.com>.
Is it documented somewhere? How to fetch and populate  "row key"  from
CqlRow api then?

-Vivek

On Mon, Jan 14, 2013 at 7:18 PM, Sylvain Lebresne <sy...@datastax.com>wrote:

> On Mon, Jan 14, 2013 at 12:48 PM, Vivek Mishra <mi...@gmail.com>wrote:
>
>> I am getting an issue, where "key" attribute's in byte[] is returned as
>> empty value.
>>
>
> We don't return this anymore as this doesn't make much sense for CQL3.
> Same as in CqlMetadata we don't return a default_name_type and
> default_value_type as they don't make any sense anymore either (they still
> exist in the thrift struct for compatibility sake, CQL2 still uses them,
> and we figured it was not worth duplicating thing by creating a specific
> Cql3Result struct).
>
> --
> Sylvain
>
>
>> Though same is working with 1.1.6
>>
>> -Vivek
>>
>>
>>
>> On Mon, Jan 14, 2013 at 4:34 PM, Sylvain Lebresne <sy...@datastax.com>wrote:
>>
>>> methods
>>
>>
>>
>>
>

Re: Cassandra 1.2 Thrift and CQL 3 issue

Posted by Sylvain Lebresne <sy...@datastax.com>.
On Mon, Jan 14, 2013 at 12:48 PM, Vivek Mishra <mi...@gmail.com>wrote:

> I am getting an issue, where "key" attribute's in byte[] is returned as
> empty value.
>

We don't return this anymore as this doesn't make much sense for CQL3. Same
as in CqlMetadata we don't return a default_name_type and
default_value_type as they don't make any sense anymore either (they still
exist in the thrift struct for compatibility sake, CQL2 still uses them,
and we figured it was not worth duplicating thing by creating a specific
Cql3Result struct).

--
Sylvain


> Though same is working with 1.1.6
>
> -Vivek
>
>
>
> On Mon, Jan 14, 2013 at 4:34 PM, Sylvain Lebresne <sy...@datastax.com>wrote:
>
>> methods
>
>
>
>

Re: Cassandra 1.2 Thrift and CQL 3 issue

Posted by Vivek Mishra <mi...@gmail.com>.
Hi,
I am trying to migrate Kundera Thrift API from 1.1.6 from 1.2 and changing *
execute_cql_query* to* execute_cql3_query*(with consistenceLevel). I am
getting an issue, where "key" attribute's in byte[] is returned as empty
value.

Though same is working with 1.1.6

-Vivek



On Mon, Jan 14, 2013 at 4:34 PM, Sylvain Lebresne <sy...@datastax.com>wrote:

> methods

Re: Cassandra 1.2 Thrift and CQL 3 issue

Posted by Sylvain Lebresne <sy...@datastax.com>.
On Sun, Jan 13, 2013 at 5:59 PM, Shahryar Sedghi <sh...@gmail.com> wrote:

> Since new cql3 methods require ConsistencyLevel.xxx, is consistency level
> at the query has precedence over this level at the api or not.
>

There is no "consistency level at the query level" anymore. That's one of
the breaking change (not the least one arguably) made between the beta
version of CQL3 shipped in 1.1 and the final shipped in 1.2 (the reference
for CQL3 final is at http://cassandra.apache.org/doc/cql3/CQL.html and
should hopefully be up to date. You will see that there is no concept of
consistency level in the language anymore). The reasoning is at
https://issues.apache.org/jira/browse/CASSANDRA-4734. That's why thrift has
specific CQL3 methods now.

--
Sylvain



> The answer to this question is important for general purpose framework
> code like JDBC driver that hides these difference.
>
> Thanks in advance
>
> Shahryar
>
>
> On Sat, Jan 12, 2013 at 1:39 PM, Shahryar Sedghi <sh...@gmail.com>wrote:
>
>> Thanks Brian
>>
>> it is not the same issue, and stack trace is different. It is a simple
>> test case and I have 3 columns and I populate all of them with:
>> cqlsh:somedb> CREATE TABLE  test(interval int,id text, body text, primary
>> key (interval, id));
>> cqlsh:somedb> insert into test (interval, id, body) values(3, 'key3',
>> 'body3');
>> cqlsh:somedb> insert into test (interval, id, body) values(1, 'key1',
>> 'body1');
>> cqlsh:somedb> insert into test (interval, id, body) values(2, 'key2',
>> 'body2');
>>
>> as you see in your case it was explicitly dealing with CQL3 on the
>> Cassandra side. I think in my case it is not recognizing it as CQL3.
>>
>> *at
>> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4062)
>> *
>>
>> at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
>> at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
>> at
>> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
>>
>> as in my case it does not get  to the same class
>>
>>
>>     *at
>> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4036)
>> *
>>     at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
>>     at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
>>     at
>> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
>>
>>
>> I am doing something wrong on client side that Cassandra thinks it is
>> CQL2 (aka. cql). How do you tell thrift it is CQL 3?
>>
>> Thanks
>>
>>
>> On Sat, Jan 12, 2013 at 12:48 PM, Shahryar Sedghi <sh...@gmail.com>wrote:
>>
>>> Hi
>>>
>>> I am trying to test my application that runs with JDBC, CQL 3 with
>>> Cassandra 1.2. After getting many weird errors and downgrading from JDBC to
>>> thrift, I realized the thrift on Cassandra 1.2 has issues with wide rows.
>>> If I define the table as:
>>>
>>> CREATE TABLE  test(interval int,id text, body text, primary key
>>> (interval, id));
>>>
>>> select interval, id, body from test;
>>>
>>>  fails with:
>>>
>>> ERROR [Thrift:16] 2013-01-11 18:23:35,997 CustomTThreadPoolServer.java
>>> (line 217) Error occurred during processing of message.
>>> java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
>>>     at
>>> org.apache.cassandra.config.CFMetaData.getColumnDefinitionFromColumnName(CFMetaData.java:923)
>>>     at
>>> org.apache.cassandra.cql.QueryProcessor.processStatement(QueryProcessor.java:502)
>>>     at
>>> org.apache.cassandra.cql.QueryProcessor.process(QueryProcessor.java:789)
>>>     at
>>> org.apache.cassandra.thrift.CassandraServer.execute_cql_query(CassandraServer.java:1652)
>>>     at
>>> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4048)
>>>     at
>>> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4036)
>>>     at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
>>>     at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
>>>     at
>>> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
>>>     at
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1121)
>>>     at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
>>>     at java.lang.Thread.run(Thread.java:780)
>>>
>>> Same code works well with Cassandra 1.1.
>>>
>>> At the same time, if I define the table as:
>>> CREATE TABLE  test1(interval int,id text, body text, primary key
>>> (interval));
>>>
>>> everything works fine. I am using
>>>
>>> DataStax Community 1.2
>>>
>>> apache-cassandra-clientutil-1.2.0.jar
>>> apache-cassandra-thrift-1.2.0.jar
>>> libthrift-0.7.0.jar
>>>
>>> Apparently client.set_cql_version("3.0.0"); has no effect either. Is
>>> there a setting that I miss on the client side to dictate cql3 or it is a
>>> bug?
>>>
>>> Thanks in advance
>>>
>>> Shahryar
>>>
>>> --
>>> "Life is what happens while you are making other plans." ~ John Lennon
>>>
>>
>>
>>
>> --
>> "Life is what happens while you are making other plans." ~ John Lennon
>>
>
>
>
> --
> "Life is what happens while you are making other plans." ~ John Lennon
>

Re: Cassandra 1.2 Thrift and CQL 3 issue

Posted by Shahryar Sedghi <sh...@gmail.com>.
I finally realized  that Thrift API has changed from 1.1 to 1.2 and my code
and modified JDBC driver works well except I get an exception on the system
log when I close the connection. Looks like it is an old issue reappearing.
I have evaluated new Java driver, it is easier and more practical than JDBC
for Cassandra and I will eventually move there, but I need to fix this
first.

Thrift API has new  prepare_cql3_query and
client.execute_prepared_cql3_query, which I expected even if it exists due
to changes on the server side to be private and
client.set_cql_version("3.0.0") should take care of the differences.

So the remaining question is:

Since new cql3 methods require ConsistencyLevel.xxx, is consistency level
at the query has precedence over this level at the api or not. The answer
to this question is important for general purpose framework code like JDBC
driver that hides these difference.

Thanks in advance

Shahryar


On Sat, Jan 12, 2013 at 1:39 PM, Shahryar Sedghi <sh...@gmail.com> wrote:

> Thanks Brian
>
> it is not the same issue, and stack trace is different. It is a simple
> test case and I have 3 columns and I populate all of them with:
> cqlsh:somedb> CREATE TABLE  test(interval int,id text, body text, primary
> key (interval, id));
> cqlsh:somedb> insert into test (interval, id, body) values(3, 'key3',
> 'body3');
> cqlsh:somedb> insert into test (interval, id, body) values(1, 'key1',
> 'body1');
> cqlsh:somedb> insert into test (interval, id, body) values(2, 'key2',
> 'body2');
>
> as you see in your case it was explicitly dealing with CQL3 on the
> Cassandra side. I think in my case it is not recognizing it as CQL3.
>
> *at
> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4062)
> *
>
> at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
> at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
> at
> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
>
> as in my case it does not get  to the same class
>
>
>     *at
> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4036)
> *
>     at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
>     at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
>     at
> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
>
>
> I am doing something wrong on client side that Cassandra thinks it is
> CQL2 (aka. cql). How do you tell thrift it is CQL 3?
>
> Thanks
>
>
> On Sat, Jan 12, 2013 at 12:48 PM, Shahryar Sedghi <sh...@gmail.com>wrote:
>
>> Hi
>>
>> I am trying to test my application that runs with JDBC, CQL 3 with
>> Cassandra 1.2. After getting many weird errors and downgrading from JDBC to
>> thrift, I realized the thrift on Cassandra 1.2 has issues with wide rows.
>> If I define the table as:
>>
>> CREATE TABLE  test(interval int,id text, body text, primary key
>> (interval, id));
>>
>> select interval, id, body from test;
>>
>>  fails with:
>>
>> ERROR [Thrift:16] 2013-01-11 18:23:35,997 CustomTThreadPoolServer.java
>> (line 217) Error occurred during processing of message.
>> java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
>>     at
>> org.apache.cassandra.config.CFMetaData.getColumnDefinitionFromColumnName(CFMetaData.java:923)
>>     at
>> org.apache.cassandra.cql.QueryProcessor.processStatement(QueryProcessor.java:502)
>>     at
>> org.apache.cassandra.cql.QueryProcessor.process(QueryProcessor.java:789)
>>     at
>> org.apache.cassandra.thrift.CassandraServer.execute_cql_query(CassandraServer.java:1652)
>>     at
>> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4048)
>>     at
>> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4036)
>>     at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
>>     at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
>>     at
>> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
>>     at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1121)
>>     at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
>>     at java.lang.Thread.run(Thread.java:780)
>>
>> Same code works well with Cassandra 1.1.
>>
>> At the same time, if I define the table as:
>> CREATE TABLE  test1(interval int,id text, body text, primary key
>> (interval));
>>
>> everything works fine. I am using
>>
>> DataStax Community 1.2
>>
>> apache-cassandra-clientutil-1.2.0.jar
>> apache-cassandra-thrift-1.2.0.jar
>> libthrift-0.7.0.jar
>>
>> Apparently client.set_cql_version("3.0.0"); has no effect either. Is
>> there a setting that I miss on the client side to dictate cql3 or it is a
>> bug?
>>
>> Thanks in advance
>>
>> Shahryar
>>
>> --
>> "Life is what happens while you are making other plans." ~ John Lennon
>>
>
>
>
> --
> "Life is what happens while you are making other plans." ~ John Lennon
>



-- 
"Life is what happens while you are making other plans." ~ John Lennon

Re: Cassandra 1.2 Thrift and CQL 3 issue

Posted by Shahryar Sedghi <sh...@gmail.com>.
Thanks Brian

it is not the same issue, and stack trace is different. It is a simple test
case and I have 3 columns and I populate all of them with:
cqlsh:somedb> CREATE TABLE  test(interval int,id text, body text, primary
key (interval, id));
cqlsh:somedb> insert into test (interval, id, body) values(3, 'key3',
'body3');
cqlsh:somedb> insert into test (interval, id, body) values(1, 'key1',
'body1');
cqlsh:somedb> insert into test (interval, id, body) values(2, 'key2',
'body2');

as you see in your case it was explicitly dealing with CQL3 on the
Cassandra side. I think in my case it is not recognizing it as CQL3.

*at
org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4062)
*
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
at
org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)

as in my case it does not get  to the same class

    *at
org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4036)
*
    at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
    at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
    at
org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)


I am doing something wrong on client side that Cassandra thinks it is  CQL2
(aka. cql). How do you tell thrift it is CQL 3?

Thanks


On Sat, Jan 12, 2013 at 12:48 PM, Shahryar Sedghi <sh...@gmail.com>wrote:

> Hi
>
> I am trying to test my application that runs with JDBC, CQL 3 with
> Cassandra 1.2. After getting many weird errors and downgrading from JDBC to
> thrift, I realized the thrift on Cassandra 1.2 has issues with wide rows.
> If I define the table as:
>
> CREATE TABLE  test(interval int,id text, body text, primary key (interval,
> id));
>
> select interval, id, body from test;
>
>  fails with:
>
> ERROR [Thrift:16] 2013-01-11 18:23:35,997 CustomTThreadPoolServer.java
> (line 217) Error occurred during processing of message.
> java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
>     at
> org.apache.cassandra.config.CFMetaData.getColumnDefinitionFromColumnName(CFMetaData.java:923)
>     at
> org.apache.cassandra.cql.QueryProcessor.processStatement(QueryProcessor.java:502)
>     at
> org.apache.cassandra.cql.QueryProcessor.process(QueryProcessor.java:789)
>     at
> org.apache.cassandra.thrift.CassandraServer.execute_cql_query(CassandraServer.java:1652)
>     at
> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4048)
>     at
> org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:4036)
>     at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
>     at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
>     at
> org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
>     at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1121)
>     at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
>     at java.lang.Thread.run(Thread.java:780)
>
> Same code works well with Cassandra 1.1.
>
> At the same time, if I define the table as:
> CREATE TABLE  test1(interval int,id text, body text, primary key
> (interval));
>
> everything works fine. I am using
>
> DataStax Community 1.2
>
> apache-cassandra-clientutil-1.2.0.jar
> apache-cassandra-thrift-1.2.0.jar
> libthrift-0.7.0.jar
>
> Apparently client.set_cql_version("3.0.0"); has no effect either. Is there
> a setting that I miss on the client side to dictate cql3 or it is a bug?
>
> Thanks in advance
>
> Shahryar
>
> --
> "Life is what happens while you are making other plans." ~ John Lennon
>



-- 
"Life is what happens while you are making other plans." ~ John Lennon