Reputation: 1023
Let's assue that rowkey 1 has values for f1:c1, f1:c2 Where as rowkey 2 has values for f1:c1 only. row 2 doesn't have f1:c2.
How do i recognize such rows(the ones without column populated)?
Upvotes: 1
Views: 74
Reputation: 29155
You want to know from row then try like this...
HTable t = new HTable(conf....);
ResultScanner scanner = t.getScanner(new Scan());
for (Result rr = scanner.next(); rr != null; rr = scanner.next())
{
if (rr.getValue("YourFamily" , "YourQualifier").equals(Bytes.toBytes("d"))
{
// do some thing
} else { return; // if you want to skip } } }
See Result
result.getFamilyMap()
is one more way. But its not recommended due to performance.. see the doc of this method
However, HTableDescriptor.html has already hasfamily method.
boolean hasFamily(byte[] familyName)
Checks to see if this table contains the given column family
Upvotes: 1