Jayan Kuttagupthan
Jayan Kuttagupthan

Reputation: 550

Equivalent of Order By operation in HBase

Am working on a project which uses HBase. Even though I formed the rowkey as good as possible, still in some scenarios I need to get the results in either ascending or descending order. Is there anything in HBase which is equivalent to "order by" operation in MySQL? Or is Order By on a specific column qualifier possible in HBase?

Upvotes: 5

Views: 3246

Answers (2)

Jack Daniel's
Jack Daniel's

Reputation: 2613

I know post is old but for future reference. Scan (Hbase 0.98+) now supports setReversed

public Scan setReversed(boolean reversed)
  Set whether this scan is a reversed one
  This is false by default which means forward(normal) scan.

Parameters:
 reversed - if true, scan will be backward order
Returns:

Ref:- Hbase Scan Tutorial

Upvotes: 3

Ian Varley
Ian Varley

Reputation: 9457

No; you need to read the data in the order it's sorted in the row key, then do your own sort (e.g. in java or whatever language you're using).

Upvotes: 5

Related Questions