hello_yun
hello_yun

Reputation: 21

How to resolve HBase query data by row like oracle/mysql in(row1,row2,row3...)

at oracle/mysql we usually query record use

select * from test t where t.id in(1001,1002,1003);

but hbase has no that api to select data,only can use scan(startRow) and endRow;

who have reolve this question,or have method to do this. thanks.

Upvotes: 2

Views: 388

Answers (2)

Donald Miner
Donald Miner

Reputation: 39913

I completely agree with Arnon... HBase is not really an RDBMS replacement.

To get some of the query functionality you are looking for, you should consider using Hive, which is a almost-SQL implementation that runs over data in Hadoop or HBase.

When interacting with HBase with Java like you mention in your question, you can use a filter, specifically the ValueFilter, to filter out values. This will make it so only rows that match the criterion to be returned. Take a look at the hbase reference guide on filters to learn more on how to implement this.

Upvotes: 0

Arnon Rotem-Gal-Oz
Arnon Rotem-Gal-Oz

Reputation: 25919

If you're looking for HBase as a replacement for an RDBMS than don't. HBase is much more limited in the way you can query data.

In any event if your row key in HBase is id you can do the query you mentioned as 3 GETs by key

Upvotes: 1

Related Questions