hadoop - HBase Sort By Value -


I am retrieving the value from the SingleColumnValueFilter, Scan, getScanner, and hbase table. The resulting values ​​are sorted in line ID-VISA. But I want to sort the result in Man-Vis.

Example:

  Hb Base Table: Roid | Col1: Zodiac. Col1: Balance 1 5,000 1000 2 3000 1500 3 4000 500   

Now, when I select the amount in the web UI (which I had customized) After that, the result should be sorted according to the amount.

  Expected Result After Selected Zodiac Column: Roid | ** Call 1: Amount ** | Col1: Balance 2 3000 1500 3 4000 500 1 5,000 1000    

If you want to sort The value of things are unfortunately, it will not be so in the HBbase. HB arranges your data based on the row key and it does syntactically.

What you should do, make the secondary index, where the linear value is included. The value is numeric in your case, so you have to do lexifographical sorting to make your numbers work properly.

Here's how you can create your secondary index:

  Hbus table: Roid | Col1: Zodiac. Col1: Balance Val 2000500 rowID 3 val001000 rowID 1 val001500 rodID 2   

When you receive a secondary index, it will return the line ID of your original data. Use that line ID to get your remaining data from the original record.

Comments