incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xu Renjie <xrjxrjxrj...@gmail.com>
Subject Re: create secondary index on column family
Date Sun, 24 Mar 2013 10:08:50 GMT
Thanks, aaron.

On Sun, Mar 24, 2013 at 1:45 AM, aaron morton <aaron@thelastpickle.com>wrote:

> But a error is thrown saying "can not parse name as hex bytes".
>
> If the comparator is Bytes then the column names need to be a hex string.
>
> The easiest thing to do is create a CF where the comparator is UTF8Type so
> you can use string column names.
>

I wonder how can I change to a hex string, I tried like "ab", it's OK. But
If I enter "abcd", it throw "can not parse as hex bytes" also.
So is there a way to convert a string to hex form in Cassandra-cli? Or
other feasible way?

>
>
just that the UTF8Type needs to be validated before storing the data into
> database and BytesType need not to?
>
> It takes *very* little additional effort.
>

So the stored bytes are the same, right?

>
>
Cheers
>
>
> -----------------
> Aaron Morton
> Freelance Cassandra Consultant
> New Zealand
>
> @aaronmorton
> http://www.thelastpickle.com
>
> On 23/03/2013, at 12:10 AM, Xu Renjie <xrjxrjxrjnet@gmail.com> wrote:
>
> Sorry, continued:
>    I have created a column family User with no parameters specified, just
>      create column family User.
>  Then I checked that the default comparator is BytesType.
>
>   Then I want to create secondary index on one column like below:
>   update column family User with column_metadata=[{column_name:name,
> validation_class:BytesType, index_type:0}];
> But a error is thrown saying "can not parse name as hex bytes".
>
> So I wonder under this situation, is it possible to create index using
> cassandra-cli, if possible, how?
>
> Furthermore, I wonder what's the difference of type BytesType and UTF8Type
> and other types underlying.
> If I store string 'name' into database, do they have the same internal
> bytes stored in Cassandra,
> just that the UTF8Type needs to be validated before storing the data into
> database and BytesType need not to?
>
>
> On Fri, Mar 22, 2013 at 7:00 PM, Xu Renjie <xrjxrjxrjnet@gmail.com> wrote:
>
>> Hello, guys:
>>    I am new to Cassandra. I am currently using cassandra-cli(version
>> 1.1.6).
>>
>
>
>

Mime
View raw message