hbase 判斷列族是否存在


 1 public static boolean isExistColumnFamily(String tableName,String cf) throws IOException {  2         if(isExistTable(tableName)) {  3             Table table = conn.getTable(TableName.valueOf(tableName));  4             TableDescriptor tableDescriptor = table.getDescriptor();  5             ColumnFamilyDescriptor descriptor = tableDescriptor.getColumnFamily(Bytes.toBytes(cf));  6             return descriptor==null?false:true;  7         }else {  8             return false;  9  } 10  } 11 
12 
13     public static boolean isExistTable(String tableName) throws IOException { 14         return admin.tableExists(TableName.valueOf(tableName)); 15     }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM