有没有办法限制Hbase的列数
有没有办法限制Hbase中特定行下的列数?我见过限制行的方法。我想知道是否有任何方法可以限制列族值
,例如
行 columnfamily(page) 值
1 第1页sp ; 1
1 第2页sp ; 2
1 第3页sp ; 3
我需要检索列族 page:1 和 page:2 的 row1 值
是否可以?
Is there any way to limit the number of columns under a particular row in Hbase? I have seen methods to limit rows. I wonder if there is any ways i can limit column family values
Like,
row columnfamily(page) value
1 page:1 1
1 page:2 2
1 page:3 3
I need to retrieve row1 values for column families page:1 and page:2
Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有多种不同的方法可以解决这个问题。基本上,您需要一个服务器端过滤器来限制 Get/Scan 中的返回数据。通常,这可以通过协处理器来完成,但这仍在开发中,因此您确实希望对查询应用过滤器。
过滤器示例: http://svn.apache.org/repos/asf/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/filter/
最简单的例子是前缀过滤器(尽管看起来您想要某种范围过滤器)。只是为了让您大致了解这是如何工作的,以下是如何将 PrefixFilter 应用于 Get:
There are a number of different ways that you can go with this problem. Basically, you want a server-side filter to limit your return data in a Get/Scan. Normally, this would be done with a co-processor, but that is still under development, so you really want to apply a filter to your query.
Example Filters: http://svn.apache.org/repos/asf/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/filter/
The easiest example would be a prefix filter (although it looks like you want some sort of range filter). Just to give you a rough idea of how this would work, here's how you apply a PrefixFilter to a Get:
这是可能的。
扫描时使用 http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#addColumn(byte[], byte[])
当 get-ting 使用时
http ://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Get.html#addColumn(byte[], byte[])
如果列键是可预测的,例如 key是一个索引,然后基于特定值,可以通过迭代来添加键。此外,如果条件可能是随机且复杂的,您也可以使用过滤器,例如&gt; 1和< 3、键入 (3, 10, 11) 等。用于过滤器使用 这个。有许多预先实现的过滤器。您可能对 限定符过滤器感兴趣。
希望这有帮助。
It is possible.
When scan-ning use http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html#addColumn(byte[], byte[])
When get-ting use
http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Get.html#addColumn(byte[], byte[])
If the column key is predictable, for example, key is an index, then based on a particular value the keys could be added by iterating. Besides you could use filters as well if the conditioning could be random and complicated for example > 1 and < 3, key in (3, 10, 11) etc. For filter use this. There are host of pre-implemented filters. You would probably be interested in the qualifier filter.
Hope this helps.