从hbase扫描仪分类结果 [英] Sorted results from hbase scanner

查看:114
本文介绍了从hbase扫描仪分类结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检索hbase列族中的值以任意排序顺序相同?

像列家族    值

---------------------------------

        栏目:1             1

       栏目:3             2

       栏目:4             3

       栏目:2             4

解决方案

HBase本身不会这样做,相反,您可以使用Result.raw检索KeyValues列表[1]方法,将它放在一个List中,并通过将自己的比较器传递给Collections.sort [2]来对其进行排序。
$ b


  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)


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

解决方案

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)

这篇关于从hbase扫描仪分类结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆