我正在研究hbase table分页。我需要实现的功能是,UI分页表应具有下一个/前进和后退/后退功能。
使用PageFilter实现的转发选项但是为了向后,我需要从结束键到最近和向后的行(20)。 例如。向后获取所有记录1000 - 980。
我无法在hbase源代码中找到满足我要求的任何内容。任何想法我们如何实现它?
PS:我的行键是多个字段的复合键,数据大小为TB。
答案 0 :(得分:1)
在hbase .98中,有一个新的反向扫描选项,代码如此简单
scan.setReversed(true);
答案 1 :(得分:0)
您可以在hbase表反向顺序中从命令行迭代值,并且可以对逆序行使用过滤器
实施例: -
hbase(main):030:0> scan 'test_use'
ROW COLUMN+CELL
1 column=usage:ACP, timestamp=1495474486145, value=3400
1 column=usage:UseTime, timestamp=1495474486145, value=2009-05-16 17:37:13.427
1 column=usage:VisualID, timestamp=1495474486145, value=1
2 column=usage:ACP, timestamp=1495474881861, value=3400
2 column=usage:UseTime, timestamp=1495474881861, value=2009-05-16 17:37:13.427
2 column=usage:VisualID, timestamp=1495474881861, value=2
3 column=usage:ACP, timestamp=1504022698257, value=3.1
4 column=usage:ACP, timestamp=1504022785705, value=4.1
4 row(s) in 0.0930 seconds
hbase(main):031:0> scan 'test_use',{REVERSED=>true}
ROW COLUMN+CELL
4 column=usage:ACP, timestamp=1504022785705, value=4.1
3 column=usage:ACP, timestamp=1504022698257, value=3.1
2 column=usage:ACP, timestamp=1495474881861, value=3400
2 column=usage:UseTime, timestamp=1495474881861, value=2009-05-16 17:37:13.427
2 column=usage:VisualID, timestamp=1495474881861, value=2
1 column=usage:ACP, timestamp=1495474486145, value=3400
1 column=usage:UseTime, timestamp=1495474486145, value=2009-05-16 17:37:13.427
1 column=usage:VisualID, timestamp=1495474486145, value=1
4 row(s) in 0.0500 seconds
hbase(main):032:0> scan 'test_use',{REVERSED=>true,STARTROW=>"1"}
ROW COLUMN+CELL
1 column=usage:ACP, timestamp=1495474486145, value=3400
1 column=usage:UseTime, timestamp=1495474486145, value=2009-05-16 17:37:13.427
1 column=usage:VisualID, timestamp=1495474486145, value=1
1 row(s) in 0.0270 seconds