Hi,
Following code is I got used to create table with index.
Now, I think it's no need for us to keep multiple version of data.
How can I set my hbase table only to keep one version of data?
Better to give me some codes that I can add to my following function.
Thanks
public void createTableWithIdx(String tablename,String
columnfamily,String idx_columnfamily,String idx_column) throws IOException
{
HTableDescriptor desc = new HTableDescriptor(tablename);
String[] temp;
String delimiter = ",";
temp = columnfamily.split(delimiter);
for(int i =0; i < temp.length ; i++){
desc.addFamily(new HColumnDescriptor(temp[i]));
}
IndexedTableDescriptor idx_desc = new IndexedTableDescriptor(desc);
idx_desc.addIndex(new IndexSpecification(idx_column,
Bytes.toBytes(idx_columnfamily+":"+idx_column)));
IndexedTableAdmin admin = null;
admin = new IndexedTableAdmin(config);
admin.createIndexedTable(idx_desc);
System.out.println(tablename+" "+" create table and index
successfully");
}
Fleming Chiu(邱宏明)
707-6128
[email protected]
週一無肉日吃素救地球(Meat Free Monday Taiwan)
---------------------------------------------------------------------------
TSMC PROPERTY
This email communication (and any attachments) is proprietary information
for the sole use of its
intended recipient. Any unauthorized review, use or distribution by anyone
other than the intended
recipient is strictly prohibited. If you are not the intended recipient,
please notify the sender by
replying to this email, and then delete this email and any copies of it
immediately. Thank you.
---------------------------------------------------------------------------