hbase_user
hbase_user

Reputation: 529

Sorted results from hbase scanner

How to retrieve hbase column family "values" in any sorted order of the same?

like
column family      value
---------------------------------
        column:1               1
        column:3               2
        column:4               3
        column:2               4

Upvotes: 3

Views: 4331

Answers (1)

Jean-Daniel Cryans
Jean-Daniel Cryans

Reputation: 176

HBase itself won't do that, instead you could retrieve the list of KeyValues using the Result.raw[1] method, put that in a List and sort it by passing your own comparator to Collections.sort[2].

  1. http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Result.html#raw()
  2. http://download.oracle.com/javase/6/docs/api/java/util/Collections.html#sort(java.util.List, java.util.Comparator)

Upvotes: 6

Related Questions