为特定行列获取行HBase
答
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;
}
结果r是一个理想的行。
答
如果你是在一个家庭只是有兴趣,你可以设置扫描仪获取只有家庭
Scan scan = new Scan(Bytes.toBytes(startKey),Bytes.toBytes(endKey);
scan.addFamily(Bytes.toBytes(familyName));
我达到一个答案,如果你有另一种解决方案,请咨询我。 为(结果RR = scanner.next(); RR = NULL;!RR = scanner.next()){ \t \t \t \t的NavigableMap familyMap = rr.getFamilyMap(Bytes.toBytes( “信息”)); \t \t \t \t byte [] y =(byte [])familyMap.firstEntry()。getKey(); \t \t \t \t System.out.println(Bytes.toString(y)); \t \t } – Mahdi 2012-03-17 11:27:35