使用 HBase shell 扫描 HTable 行以获取特定列值 [英] Scan HTable rows for specific column value using HBase shell
问题描述
我想从 hbase shell 扫描 HTable 中的行,其中列族(即 Tweet)具有特定值(即 user_id).
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).
现在我想查找所有 tweet:user_id 的值为 test1
的行,因为该列的值为 'test1'
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.
是否可以通过 HBase Shell 做到这一点?
Is it possible to do this via HBase Shell?
我检查了 这个问题好吧.
推荐答案
没有Hive也可以:
scan 'filemetadata',
{ COLUMNS => 'colFam:colQualifier',
LIMIT => 10,
FILTER => "ValueFilter( =, 'binaryprefix:<someValue.e.g. test1 AsDefinedInQuestion>' )"
}
注意:为了找到所有包含 test1 作为问题中指定值的行,请在过滤器中使用 binaryprefix:test1(请参阅 this answer 获取更多示例)
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屋!