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 }