//
public static ArrayList<String> getcolname(String rowkey,String tablename,String colf) throws IOException{
Get get = new Get(Bytes.toBytes(rowkey));
ArrayList<String> cols = new ArrayList<String>();
Table table = conn.getTable(TableName.valueOf(tablename));
Result result = table.get(get);
Map<byte[], byte[]> familyMap = result.getFamilyMap(Bytes.toBytes(colf));
for(Map.Entry<byte[], byte[]> entry:familyMap.entrySet()){
cols.add(Bytes.toString(entry.getKey()));
System.out.println(Bytes.toString(entry.getKey()));
}
return cols;
}
hbase通过表名和rowkey获取列族下所有的列名
最新推荐文章于 2023-05-15 14:16:35 发布