简体   繁体   中英

How to use “multiple AND in columns” to filter the row in hbase?

The scenario like this: In a hbase table, there are different columns for different rows, eg: row1 have columns fm:a, fm:b, fm:c row2 have columns fm:a, fm:d

So I want to use a scan to test if a row have both column fm:a & fm:b, if so, return this row, otherwise, this row should not be returned in the scan result. In above case, I just want to row1 be returned.

I check the Filters in hbase, looks like if do this in Filter level, the performance will be bad. Any ideas?

you need to add each column to the scan - sth like this. Create a hashTable , say ht

for each columnFamily in ht:
   { for each column in columnFamily:
     { scan.addColumn(Bytes.toBytes(columnFamily), Bytes.toBytes(column)); }
   }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM