本文介绍了如何获取所有版本的HBase行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在hbase中执行以下命令:
I am trying to do the following command in hbase:
scan 'testLastVersion' {VERSIONS=>8}
并且它仅返回该行的最后一个版本.
您知道如何通过命令外壳和Java代码获取row的所有版本吗?谢谢!
And it return only the last version of the row.
Do you know how can I get all the versions of row through command shell and through java code?Thanks!
推荐答案
我认为您在此处缺少'.'.命令应该是这样的:
I think you are missing the ',' there.. The command should be something like this:
scan 'emp', {VERSIONS=>8}
即使您缺少逗号,HBase也会抛出错误:
Even if you are missing the comma, HBase should throw an error:
SyntaxError: (hbase):16: syntax error, unexpected tLCURLY
我试图模拟您的情况并获得所有结果.请在下面找到它们.
I tried to simulate a your scenario and got all the results. Please find them below.
hbase(main):010:0> put 'emp', '1', 'personal_data:name', 'Ajay'
0 row(s) in 0.0220 seconds
hbase(main):012:0> put 'emp', '1', 'personal_data:name', 'Vijay'
0 row(s) in 0.0140 seconds
hbase(main):014:0> put 'emp', '1', 'personal_data:name', 'Ceema'
0 row(s) in 0.0070 seconds
hbase(main):017:0> scan 'emp', {VERSIONS=>3}
ROW COLUMN+CELL
1 column=personal_data:name, timestamp=1472651320449, value=Ceema
1 column=personal_data:name, timestamp=1472651313396, value=Vijay
1 column=personal_data:name, timestamp=1472651300718, value=Ajay
1 row(s) in 0.0220 seconds
这篇关于如何获取所有版本的HBase行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!