为特定行列获取行HBase

问题描述:

我正在编写一个应用程序,该应用程序在HBase by JSP中的特定表中显示数据。我想要获得特定列族中的所有列。为特定行列获取行HBase

有没有办法做到这一点?

+0

我达到一个答案,如果你有另一种解决方案,请咨询我。 为(结果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

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));