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 486F1D6C8 for ; Thu, 27 Sep 2012 00:57:16 +0000 (UTC) Received: (qmail 91338 invoked by uid 500); 27 Sep 2012 00:57:13 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 91323 invoked by uid 500); 27 Sep 2012 00:57:13 -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 91315 invoked by uid 99); 27 Sep 2012 00:57:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Sep 2012 00:57:13 +0000 X-ASF-Spam-Status: No, hits=1.8 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of owenzhang1990@gmail.com designates 209.85.215.172 as permitted sender) Received: from [209.85.215.172] (HELO mail-ey0-f172.google.com) (209.85.215.172) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Sep 2012 00:57:07 +0000 Received: by eaak13 with SMTP id k13so463567eaa.31 for ; Wed, 26 Sep 2012 17:56:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=vYiGBib+5wnmj4CQcNGV4y0xKKT4ZsXLN5yr12izeuc=; b=XW3gVpMt44VfwlIfhcxgn4xKG7+/4VwZJNecih4GCm8k4kwhSF4Qo4MaCpyclO2jX1 gYZjQteNAMgpUDHUcAZbUQVIShSGptIH6peAQl29EFtOqrWIBWw16VukJyb12t8z2Q5b 2qQlifwGSQfLSGRnZnXaMEPNu+aC7P7p+j/31ncSkdzV0t0af2IagKuFQ7WGFtaL/ou7 sq+VDJ67TANgAOKxR1+Wnt1/LxQBHSvjSsDSriTzDaV/SkxOehColqzkE4WOQFt78vxN h6RYyJD3DUNDTrJyk3p9Qns8V6R2t8tIJm3fFWSrOiArP8xMdso3KbhEs9eJ8GIGfvdC 2y5g== MIME-Version: 1.0 Received: by 10.14.193.136 with SMTP id k8mr3896072een.9.1348707406872; Wed, 26 Sep 2012 17:56:46 -0700 (PDT) Received: by 10.14.209.198 with HTTP; Wed, 26 Sep 2012 17:56:46 -0700 (PDT) In-Reply-To: <56A68346-B726-463F-BBF4-6BED2E686102@thelastpickle.com> References: <56A68346-B726-463F-BBF4-6BED2E686102@thelastpickle.com> Date: Thu, 27 Sep 2012 08:56:46 +0800 Message-ID: Subject: Re: From: Manu Zhang To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=047d7b343e36e4806304caa46992 --047d7b343e36e4806304caa46992 Content-Type: text/plain; charset=ISO-8859-1 I mean I have modifications only on one column; do I have to add the rest columns as well? On Thu, Sep 27, 2012 at 5:18 AM, aaron morton wrote: > That looks right to me. > > btw, most people use CLI or CQL scripts to manage the schema > > Cheers > > ----------------- > Aaron Morton > Freelance Developer > @aaronmorton > http://www.thelastpickle.com > > On 25/09/2012, at 7:59 PM, Manu Zhang wrote: > > Is there an example to update column family adding secondary indices with > thrift api? Here's how I do that now...but what if I have a hundred columns? > > // add secondary index on column "o_custkey" > CfDef cf_def = new CfDef("tpch", "orders"); > cf_def.setComparator_type("UTF8Type"); > cf_def.setKey_validation_class("UTF8Type"); > List column_metadata = new LinkedList(); > ColumnDef col_def = new > ColumnDef(CassandraUtil.string2ByteBuffer("O_CUSTKEY"), "UTF8Type"); > col_def.setIndex_type(IndexType.KEYS); > column_metadata.add(col_def); > column_metadata.add(new > ColumnDef(CassandraUtil.string2ByteBuffer("O_ORDERSTATUS"), "UTF8Type")); > column_metadata.add(new > ColumnDef(CassandraUtil.string2ByteBuffer("O_TOTALPRICE"), "UTF8Type")); > column_metadata.add(new > ColumnDef(CassandraUtil.string2ByteBuffer("O_ORDERPRIORITY"), "UTF8Type")); > column_metadata.add(new > ColumnDef(CassandraUtil.string2ByteBuffer("O_CLERK"), "UTF8Type")); > column_metadata.add(new > ColumnDef(CassandraUtil.string2ByteBuffer("O_SHIPPRIORITY"), "UTF8Type")); > column_metadata.add(new > ColumnDef(CassandraUtil.string2ByteBuffer("O_COMMENT"), "UTF8Type")); > cf_def.setColumn_metadata(column_metadata); > client.system_update_column_family(cf_def); > > > --047d7b343e36e4806304caa46992 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I mean I have modifications only on one column; do I have to add the rest c= olumns as well?

On Thu, Sep 27, 2012 at 5= :18 AM, aaron morton <aaron@thelastpickle.com> wrote:<= br>
That loo= ks right to me.=A0

btw, most people use CLI or CQL scrip= ts to manage the schema=A0

Cheers
=A0
<= div style=3D"word-wrap:break-word">
-----------------
Aaron Morton
Freelance Deve= loper
@aaronmorton

On 25/09/2012, at 7:59 PM, Manu Zhang <owenzhang1990@gmail.com> w= rote:

Is there an example to update colu= mn family adding secondary indices with thrift api? Here's how I do tha= t now...but what if I have a hundred columns?

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // add secondary index on co= lumn "o_custkey"=A0
=A0 =A0 =A0 =A0=A0Cf= Def cf_def =3D new CfDef("tpch", "orders");
<= span style=3D"white-space:pre-wrap"> cf_def.setComparator_type(&quo= t;UTF8Type");
cf_def.setKey_validation= _class("UTF8Type");
List<ColumnDef> column_metadata =3D new LinkedList<Colu= mnDef>();
ColumnDef col_def =3D ne= w ColumnDef(CassandraUtil.string2ByteBuffer("O_CUSTKEY"), "U= TF8Type");
col= _def.setIndex_type(IndexType.KEYS);
=A0 =A0 =A0 =A0 column_me= tadata.add(col_def);
column_metadata.add(new ColumnDef(CassandraUtil.string2ByteBuffer("O= _ORDERSTATUS"), "UTF8Type"));
column_metadata.add(new = ColumnDef(CassandraUtil.string2ByteBuffer("O_TOTALPRICE"), "= UTF8Type"));
c= olumn_metadata.add(new ColumnDef(CassandraUtil.string2ByteBuffer("O_OR= DERPRIORITY"), "UTF8Type"));
column_metadata.add(new = ColumnDef(CassandraUtil.string2ByteBuffer("O_CLERK"), "UTF8T= ype"));
=A0 =A0= =A0 =A0 column_metadata.add(new ColumnDef(CassandraUtil.string2ByteBuffer(= "O_SHIPPRIORITY"), "UTF8Type"));
column_metadata.add(new = ColumnDef(CassandraUtil.string2ByteBuffer("O_COMMENT"), "UTF= 8Type"));
cf_def.setColumn_metadat= a(column_metadata);
client.system_update_column_family(cf_def);


--047d7b343e36e4806304caa46992--