使用HBase shell扫描特定列值的HTable行 [英] Scan HTable rows for specific column value using HBase shell

查看:325
本文介绍了使用HBase shell扫描特定列值的HTable行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从 hbase shell 中的列中扫描行,其中列家族(即Tweet)具有特定值(即user_id)。



现在我想查找tweet的所有行:user_id的值 test1 ,因为此列的值'test1' $ b $ pre $ column = tweet:user_id,timestamp = 1339581201187,value = test1

虽然我可以扫描表格以查找特定的使用情况,但是,您可以使用

 扫描'tweetsTable',{COLUMNS => 'tweet:user_id'} 

但我没有找到任何方法来扫描一行的值。



是否可以通过HBase Shell执行此操作?



我检查了此问题

  scan'filemetadata',
{COLUMNS => 'colFam:colQualifier',
LIMIT => 10,
FILTER => ValueFilter(=,'binaryprefix:< someValue.eg test1 AsDefinedInQuestion>')
}



注意:为了找到包含 test1 的所有行为问题中指定的值,请在过滤器中使用 binaryprefix:test1 (请参阅这个答案的更多例子)


I want to scan rows in a HTable from hbase shell where a column family (i.e., Tweet) has a particular value (i.e., user_id).

Now I want to find all rows where tweet:user_id has value test1 as this column has value 'test1'

column=tweet:user_id, timestamp=1339581201187, value=test1

Though I can scan table for a particular using,

scan 'tweetsTable',{COLUMNS => 'tweet:user_id'}

but I did not find any way to scan a row for a value.

Is it possible to do this via HBase Shell?

I checked this question as well.

解决方案

It is possible without Hive:

scan 'filemetadata', 
     { COLUMNS => 'colFam:colQualifier', 
       LIMIT => 10, 
       FILTER => "ValueFilter( =, 'binaryprefix:<someValue.e.g. test1 AsDefinedInQuestion>' )" 
     }

Note: in order to find all rows that contain test1 as value as specified in the question, use binaryprefix:test1 in the filter (see this answer for more examples)

这篇关于使用HBase shell扫描特定列值的HTable行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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