I would like to achieve something like this SQL query using the HBase API
SELECT * FROM customer_table WHERE firstname = "Joe" AND lastname = "Bloggs" AND email = "joe@blah.com"
HBase Table:
1 column=p:firstname, timestamp=<t>, value=Joe
1 column=p:lastname, timestamp=<t>, value=Bloggs
1 column=p:email, timestamp=<t>, value=joe@blah.com
2 column=p:firstname, timestamp=<t>, value=Joe
2 column=p:lastname, timestamp=<t>, value=Bloggs
2 column=p:email, timestamp=<t>, value=joe@blah.com
3 column=p:firstname, timestamp=<t>, value=Joe
3 column=p:lastname, timestamp=<t>, value=Bloggs
3 column=p:email, timestamp=<t>, value=joe@blah.com
Currently I have this:
val filters = Array("Joe", "Bloggs", "joe@blah.com")
// AND operator
val filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL)
filters.foreach(f => {
filterList.addFilter(new ValueFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes(f))))
})
val scan = new Scan().setFilter(filterList)
val resultScanner = table.getScanner(scan)
But, this returns no results. I would expect it to return all 3 rows. Is there another filter/function to achieve this?