Artem Maslovskiy
Artem Maslovskiy

Reputation: 68

HBase filtering non-empty strings

I have an HBase table with 'a' and 'b' column families. Every row has at least one column in family 'a', but may not have any columns in family 'b'. How can I select only rows that do not contain columns in 'b' family? (I'm using HBase Java API)

Upvotes: 0

Views: 358

Answers (1)

Sudheer
Sudheer

Reputation: 431

To scan everything for each row and a particular column family, instantiate a Scan object like shown below.

Scan scan = new Scan(); //creating a scan object for all rows.

scan.addFamily(byte[] column_family); // adding your required column family to scan object.

ResultScanner scanner = table.getScanner(scan);

for (Result result : scanner) {
// .......
}

Upvotes: 0

Related Questions