incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaron morton <aa...@thelastpickle.com>
Subject Re: create secondary index on column family
Date Sun, 24 Mar 2013 17:35:36 GMT
> 
> I tried to wrap 'name' to bytes('name'), but it would throw "can not parse FUNCTION_CALL
as hex bytes", seems this does not work.
What was the statement you used and what was the error. 

> So the stored bytes are the same, right? 

Yes. 

-----------------
Aaron Morton
Freelance Cassandra Consultant
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 24/03/2013, at 11:53 PM, Xu Renjie <xrjxrjxrjnet@gmail.com> wrote:

> 
> 
> 
> 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. 
> 
> And currently  our column families are all of Bytes, since Cassandra cannot update the
comparator, it's not easy to change to UTF8Type.
> I tried to wrap 'name' to bytes('name'), but it would throw "can not parse FUNCTION_CALL
as hex bytes", seems this does not work.
>> 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. 
> 
> 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