如何从HBase中的特定行和列中获取多个版本 [英] How to get multiple versions from one specific row and column in HBase
本文介绍了如何从HBase中的特定行和列中获取多个版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我的问题是,如何使用任何HBase命令列出所有更改的值?我搜索了很多,但没有找到任何有用的链接。
解决方案
您可以指定扫描版本的数量并且它会检索它们:
HTable tbl = new HTable(tableName);
Get q = new Get(Bytes.toBytes(key));
q.setMaxVersions(numberOfVersionsYouWant);
结果行= tbl.get(q);
NavigableMap< byte [],NavigableMap< byte [],NavigableMap< Long,byte []>>> allVersions = row.getMap();
As we know, hbase has a feature that a specific Row and specific Column can record recent change values by timestamps. So my question is, HOW TO list all the changed values using any HBase command? I googled a lot, but didn't find any useful links.
解决方案
You can specify the number of version you get for Scan and Get and it will retrieve them:
HTable tbl = new HTable(tableName);
Get q= new Get(Bytes.toBytes(key));
q.setMaxVersions(numberOfVersionsYouWant);
Result row= tbl.get(q);
NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>> allVersions=row.getMap();
这篇关于如何从HBase中的特定行和列中获取多个版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文