1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| TableName tableName = TableName.valueOf("test:test"); HColumnDescriptor columnDescriptor = new HColumnDescriptor("cf1"); HTableDescriptor tableDescriptor = new HTableDescriptor(tableName) .addFamily(columnDescriptor) .setValue("Description", "Original Table"); admin.createTable(tableDescriptor, Bytes.toBytes(1L), Bytes.toBytes(10000L), 50);
HTableDescriptor newTableDescriptor = admin.getTableDescriptor(tableName); HColumnDescriptor newColumnDescriptor = new HColumnDescriptor("cf2"); newTableDescriptor.addFamily(newColumnDescriptor) .setMaxFileSize(1024 * 1024 * 1024L) .setValue("Description", "Modified Table");
admin.disableTable(tableName); admin.modifyTable(tableName, newTableDescriptor);
|