I'm writing a application that shows data in a specific table in HBase by JSP. I want to get all columns in a specific column family for a row.
is there any way for do this?
public String[] getColumnsInColumnFamily(Result r, String ColumnFamily)
{
NavigableMap<byte[], byte[]> familyMap = r.getFamilyMap(Bytes.toBytes(ColumnFamily));
String[] Quantifers = new String[familyMap.size()];
int counter = 0;
for(byte[] bQunitifer : familyMap.keySet())
{
Quantifers[counter++] = Bytes.toString(bQunitifer);
}
return Quantifers;
}
Result r is as a desirable row.
If you are just interested in a single family you can set the scanner to fetch only that family
Scan scan = new Scan(Bytes.toBytes(startKey),Bytes.toBytes(endKey);
scan.addFamily(Bytes.toBytes(familyName));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.