You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by aaron morton <aa...@thelastpickle.com> on 2012/01/02 11:23:43 UTC

Re: CLI exception :: A long is exactly 8 bytes: 1

If you use the --debug flag when you start the CLI it always will print full stack traces. 

What is the CF definition ?  I'm guessing the column_metadata specifies that the age column is a Long

Was there existing data in the age column and if so how was it encoded ? Was the existing data was encoded as a variable length integer value? The standard IntegerType is not compatible with the LongType as the the long is fixed width. If this is the case try re-creating the index using an IntegerType. 

This worked for me…

[default@dev] create column family User
...	    with comparator = AsciiType
...	    and column_metadata =
...	    [{
...	        column_name : age,
...	        validation_class : LongType,
...	        index_type : 0,
...	        index_name : IdxAge},
...	    ];
2fd1a5c0-352b-11e1-0000-242d50cf1fb6
Waiting for schema agreement...
... schemas agree across the cluster
[default@dev] 
[default@dev] get User where age = 1;  

0 Row Returned.
Elapsed time: 33 msec(s).
[default@dev] 

Hope that helps. 

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 31/12/2011, at 6:09 AM, Sasha Dolgy wrote:

> as per the wiki link you sent, i change my query to:
> 
> get user where something = '1';
> 
> Still throws the error ... This was fine *before* I ran the update CF
> command ..
> 
> To Query Data
> get User where age = '12';
> 
> On Fri, Dec 30, 2011 at 6:05 PM, Moshiur Rahman <mo...@gmail.com> wrote:
>> I think you need to mention data type in your command. You have to run the
>> following command first:
>> assume <CFName> keys as <TypeName, i.e., utf8>
>> 
>> Otherwise, you need to mention type with each command, e.g.,
>> utf8('keyname').
>> http://wiki.apache.org/cassandra/CassandraCli
>> 
>> Moshiur
>> 
>> 
>> 
>> On Fri, Dec 30, 2011 at 10:50 AM, Sasha Dolgy <sd...@gmail.com> wrote:
>>> 
>>> Hi Everyone,
>>> 
>>> Been a while .. without any problems.  Thanks for grinding out a good
>>> product!  On 1.0.6, I applied an update to a column family to add a
>>> secondary index, and now via the CLI, when I perform a "get user where
>>> something=1" I receive the following result:
>>> 
>>> org.apache.cassandra.db.marshal.MarshalException: A long is exactly 8
>>> bytes: 1
>>> 
>>> This behaviour doesn't seem to be affecting phpcassa or hector
>>> retrieving the results of that query ... is this a silly something
>>> i've done, or something a bit more buggy with the CLI?
>>> 
>>> Thanks in advance,
>>> -sd


Re: CLI exception :: A long is exactly 8 bytes: 1

Posted by Sasha Dolgy <sd...@gmail.com>.
Hi -- Sorry for the delay, and thanks for the response.

Debug didn't print any stack traces and none are in the usual
suspected places...but thanks for that hint.  Didn't know that option
existed.  The age column is an Integer ... Updating to IntegerType
worked.  Thanks.



On Mon, Jan 2, 2012 at 11:23 AM, aaron morton <aa...@thelastpickle.com> wrote:
> If you use the --debug flag when you start the CLI it always will print full stack traces.
>
> What is the CF definition ?  I'm guessing the column_metadata specifies that the age column is a Long
>
> Was there existing data in the age column and if so how was it encoded ? Was the existing data was encoded as a variable length integer value? The standard IntegerType is not compatible with the LongType as the the long is fixed width. If this is the case try re-creating the index using an IntegerType.
>
> This worked for me…
>
> [default@dev] create column family User
> ...         with comparator = AsciiType
> ...         and column_metadata =
> ...         [{
> ...             column_name : age,
> ...             validation_class : LongType,
> ...             index_type : 0,
> ...             index_name : IdxAge},
> ...         ];
> 2fd1a5c0-352b-11e1-0000-242d50cf1fb6
> Waiting for schema agreement...
> ... schemas agree across the cluster
> [default@dev]
> [default@dev] get User where age = 1;
>
> 0 Row Returned.
> Elapsed time: 33 msec(s).
> [default@dev]
>
> Hope that helps.