MapReduce服务 MRS-删除HBase表:代码样例
时间:2025-02-12 14:58:43
代码样例
以下代码片段在com.huawei.bigdata.hbase.examples包的“HBaseExample”类的dropTable方法中。
样例代码获取方式请参考获取 MRS 应用开发样例工程。
public void dropTable() { LOG .info("Entering dropTable."); Admin admin = null; try { admin = conn.getAdmin(); if (admin.tableExists(tableName)) { // Disable the table before deleting it. admin.disableTable(tableName);//注[1] // Delete table. admin.deleteTable(tableName); } LOG.info("Drop table successfully."); } catch (IOException e) { LOG.error("Drop table failed ", e); } finally { if (admin != null) { try { // Close the Admin object. admin.close(); } catch (IOException e) { LOG.error("Close admin failed ", e); } } } LOG.info("Exiting dropTable.");}
support.huaweicloud.com/devg-mrs/mrs_06_0019.html