Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3012DF347 for ; Sun, 24 Mar 2013 10:09:21 +0000 (UTC) Received: (qmail 53540 invoked by uid 500); 24 Mar 2013 10:09:18 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 53505 invoked by uid 500); 24 Mar 2013 10:09:17 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 53471 invoked by uid 99); 24 Mar 2013 10:09:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Mar 2013 10:09:16 +0000 X-ASF-Spam-Status: No, hits=3.6 required=5.0 tests=FROM_LOCAL_NOVOWEL,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of xrjxrjxrjnet@gmail.com designates 209.85.212.170 as permitted sender) Received: from [209.85.212.170] (HELO mail-wi0-f170.google.com) (209.85.212.170) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 24 Mar 2013 10:09:10 +0000 Received: by mail-wi0-f170.google.com with SMTP id hm11so9979210wib.3 for ; Sun, 24 Mar 2013 03:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=Gg8WBUqqI2PQnGrwIyN6onVD/+F7LD95WASED59nFWo=; b=Z5eBPaEXRaaBE4bYRJ6Q2xmm52r9oVRkzfH3vng29KWyXOqoz1h2j+mtJ3uEElrmew dFB+5Wl4QIeMz4JoDg/iB+VUovR0J24PqUuSXeDAXVVYeqE3dXqrGWP8C5oa3MxBc47U M9YXJ7DpzPuEN/cNHZj7btR8Gt/ilEnKe0bWr7lDQWmmQA1qKdntRMyFekAxtvkZuhyc wSbO106v9v/X2/QKk83DYb/m3XPjZYJdjTiKayD08HBEjmKnQGGxHR3ThwsiZsWjvjUt ggjxnEDVBmxQqSfyrebjO+LqXVtOQEvp8DxvZmBK+vAxcynljof5bLWUn39zNynZ2QPQ fQfA== MIME-Version: 1.0 X-Received: by 10.180.72.228 with SMTP id g4mr6166079wiv.22.1364119730137; Sun, 24 Mar 2013 03:08:50 -0700 (PDT) Received: by 10.194.39.136 with HTTP; Sun, 24 Mar 2013 03:08:50 -0700 (PDT) In-Reply-To: <6CA68239-BD4D-465F-A10E-3A86B1CDD6E7@thelastpickle.com> References: <6CA68239-BD4D-465F-A10E-3A86B1CDD6E7@thelastpickle.com> Date: Sun, 24 Mar 2013 18:08:50 +0800 Message-ID: Subject: Re: create secondary index on column family From: Xu Renjie To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=f46d043c819ef22f0f04d8a8df2c X-Virus-Checked: Checked by ClamAV on apache.org --f46d043c819ef22f0f04d8a8df2c Content-Type: text/plain; charset=ISO-8859-1 Thanks, aaron. On Sun, Mar 24, 2013 at 1:45 AM, aaron morton 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 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 wrote: > >> Hello, guys: >> I am new to Cassandra. I am currently using cassandra-cli(version >> 1.1.6). >> > > > --f46d043c819ef22f0f04d8a8df2c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks, aaron.

On Sun, Mar 24, 2013 at 1:45 AM, aaron morton &l= t;aaron@thelas= tpickle.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.=A0

The easiest thing to do is create a= CF where the comparator is UTF8Type so you can use string column names.=A0=
=A0=A0
I wonder how can I change to = a hex string, I tried like "ab", it's OK. But If I enter &quo= t;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?
=A0
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.=A0

So the stored bytes are the same, right?
=A0
Cheers

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


On 23/03/2013, at 12:10 AM, Xu Renjie <xrjxrjxrjnet@gmail.com> wro= te:

Sorry, continued:
=A0=A0 I have created a column family User with = no parameters specified, just
=A0 =A0=A0 create column family User.
<= /div>=A0Then I checked that the default comparator is BytesType.
=A0
=A0 Then I want to create secondary index on one column like b= elow:
=A0 update column family User with column_metadata=3D[{colum= n_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 wh= at's the difference of type BytesType and UTF8Type and other types unde= rlying.
If I store string 'name' into database, do they have the same inter= nal bytes stored in Cassandra,
just that the UTF8Type needs t= o be validated before storing the data into database and BytesType need not= to?


O= n Fri, Mar 22, 2013 at 7:00 PM, Xu Renjie <xrjxrjxrjnet@gmail.com= > wrote:
Hello, guys:
= =A0=A0 I am new to Cassandra. I am currently using cassandra-cli(version 1.= 1.6).



--f46d043c819ef22f0f04d8a8df2c--