本文整理匯總了Java中org.apache.hadoop.hbase.client.Admin.modifyColumn方法的典型用法代碼示例。如果您正苦於以下問題:Java Admin.modifyColumn方法的具體用法?Java Admin.modifyColumn怎麽用?Java Admin.modifyColumn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.hadoop.hbase.client.Admin
的用法示例。
在下文中一共展示了Admin.modifyColumn方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testModifyColumnFamily
import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@Test
public void testModifyColumnFamily() throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin();
HColumnDescriptor cfDescriptor = new HColumnDescriptor(FAMILY_0);
int blockSize = cfDescriptor.getBlocksize();
// Create a table with one families
HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
baseHtd.addFamily(cfDescriptor);
admin.createTable(baseHtd);
admin.disableTable(TABLE_NAME);
try {
// Verify the table descriptor
verifyTableDescriptor(TABLE_NAME, FAMILY_0);
int newBlockSize = 2 * blockSize;
cfDescriptor.setBlocksize(newBlockSize);
// Modify colymn family
admin.modifyColumn(TABLE_NAME, cfDescriptor);
HTableDescriptor htd = admin.getTableDescriptor(TABLE_NAME);
HColumnDescriptor hcfd = htd.getFamily(FAMILY_0);
assertTrue(hcfd.getBlocksize() == newBlockSize);
} finally {
admin.deleteTable(TABLE_NAME);
}
}
示例2: testModifyNonExistingColumnFamily
import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@Test
public void testModifyNonExistingColumnFamily() throws IOException {
Admin admin = TEST_UTIL.getHBaseAdmin();
HColumnDescriptor cfDescriptor = new HColumnDescriptor(FAMILY_1);
int blockSize = cfDescriptor.getBlocksize();
// Create a table with one families
HTableDescriptor baseHtd = new HTableDescriptor(TABLE_NAME);
baseHtd.addFamily(new HColumnDescriptor(FAMILY_0));
admin.createTable(baseHtd);
admin.disableTable(TABLE_NAME);
try {
// Verify the table descriptor
verifyTableDescriptor(TABLE_NAME, FAMILY_0);
int newBlockSize = 2 * blockSize;
cfDescriptor.setBlocksize(newBlockSize);
// Modify a column family that is not in the table.
try {
admin.modifyColumn(TABLE_NAME, cfDescriptor);
Assert.fail("Modify a non-exist column family should fail");
} catch (InvalidFamilyOperationException e) {
// Expected.
}
} finally {
admin.deleteTable(TABLE_NAME);
}
}
示例3: setUp
import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
@Before
@Override
public void setUp() throws Exception {
// Initialize the cluster. This invokes LoadTestTool -init_only, which
// will create the test table, appropriately pre-split
super.setUp();
if (!initialized) {
return;
}
// Update the test table schema so HFiles from this point will be written with
// encryption features enabled.
final Admin admin = util.getHBaseAdmin();
HTableDescriptor tableDescriptor =
new HTableDescriptor(admin.getTableDescriptor(getTablename()));
for (HColumnDescriptor columnDescriptor: tableDescriptor.getColumnFamilies()) {
columnDescriptor.setEncryptionType("AES");
LOG.info("Updating CF schema for " + getTablename() + "." +
columnDescriptor.getNameAsString());
admin.disableTable(getTablename());
admin.modifyColumn(getTablename(), columnDescriptor);
admin.enableTable(getTablename());
util.waitFor(30000, 1000, true, new Predicate<IOException>() {
@Override
public boolean evaluate() throws IOException {
return admin.isTableAvailable(getTablename());
}
});
}
}