incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manu Zhang <owenzhang1...@gmail.com>
Subject [No Subject]
Date Tue, 25 Sep 2012 07:59:38 GMT
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