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:
Date Wed, 26 Sep 2012 21:18:38 GMT
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 <owenzhang1990@gmail.com> 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<ColumnDef> column_metadata = new LinkedList<ColumnDef>();
> 		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);


Mime
View raw message