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