Get columns in a specific column family for an HBase row

I am writing an application that shows data in a specific table in HBase JSP. I want to get all columns in a specific column family for a row.

Is there any way to do this?

+7
source share
2 answers
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; } 

The result of r is the desired string.

+9
source

If you are interested in only one family, you can configure the scanner to select only this family

  Scan scan = new Scan(Bytes.toBytes(startKey),Bytes.toBytes(endKey); scan.addFamily(Bytes.toBytes(familyName)); 
+8
source

All Articles