我对hbase很新。我们需要获取表的某些数据。以下是样本数据集。我被困在创建过滤器,这对我来说似乎有点复杂。在查询中,我将获得value1,我需要将其与ID1 CQ的值进行比较,另一个值为value2,我需要将其与ID2 CQ的值进行比较。之后有多个带有列jj_的条目,这里我需要先获取以jj_开头的所有列的最新时间,然后将value3与最新的jj_ CQ的值进行比较。在sql中,我可以创建像select * ..这样的查询,其中ID1 =''和ID2 =''和ID3 =''。我如何在Hbase中实现同样的目标。任何帮助都会受到高度关注。
ROW COLUMN+CELL
1 column=d:ID1, timestamp=1496273604085, value=5678
1 column=d:ID2, timestamp=1496273604085, value=Jan
1 column=d:data, timestamp=1496273604085, value=TestData1
1 column=d:jj_01/01/2017 01:37:56 AM, timestamp=1496273604085, value=11345601/01/2017 01:37:56 AM
2 column=d:ID1, timestamp=1496273604105, value=5678
2 column=d:ID2, timestamp=1496273604105, value=Jan
2 column=d:data, timestamp=1496273604105, value=TestData2
2 column=d:jj_01/02/2017 10:37:56 AM, timestamp=1496273604105, value=11345601/02/2017 10:37:56 AM
2 column=d:jj_01/02/2017 11:37:56 PM, timestamp=1496273604105, value=11345601/02/2017 11:37:56 PM
3 column=d:ID1, timestamp=1496273604112, value=5678
3 column=d:ID2, timestamp=1496273604112, value=Jan,Feb
3 column=d:data, timestamp=1496273604112, value=TestData3
3 column=d:jj_02/01/2017 11:37:56 AM, timestamp=1496273604112, value=11345602/01/2017 11:37:56 AM
4 column=d:ID1, timestamp=1496273604124, value=5678,1234
4 column=d:ID2, timestamp=1496273604124, value=Jan,Dec
4 column=d:data, timestamp=1496273604124, value=TestData4
4 column=d:jj_02/02/2017 09:37:56 PM, timestamp=1496273604124, value=11345602/02/2017 09:37:56 PM
4 column=d:jj_02/02/2017 11:37:56 AM, timestamp=1496273604124, value=11345602/02/2017 11:37:56 AM
5 column=d:ID1, timestamp=1496273604133, value=5678,1234
5 column=d:ID2, timestamp=1496273604133, value=Jan
5 column=d:data, timestamp=1496273604133, value=TestData5
5 column=d:jj_01/05/2017 11:37:56 AM, timestamp=1496273604133, value=11345601/05/2017 11:37:56 AM
5 column=d:jj_01/06/2017 09:37:56 PM, timestamp=1496273604133, value=11345601/06/2017 09:37:56 PM
6 column=d:ID1, timestamp=1496273604138, value=5678
6 column=d:ID2, timestamp=1496273604138, value=Dec
6 column=d:data, timestamp=1496273604138, value=TestData6
6 column=d:jj_02/02/2017 09:37:56 AM, timestamp=1496273604138, value=11345602/02/2017 09:37:56 AM
7 column=d:ID1, timestamp=1496273604148, value=5678
7 column=d:ID2, timestamp=1496273604148, value=Jan
7 column=d:data, timestamp=1496273604148, value=TestData7
7 column=d:jj_02/03/2017 09:37:56 AM, timestamp=1496273604148, value=11345602/03/2017 09:37:56 AM
答案 0 :(得分:0)
您可以使用FilterList,例如
scan.setFilter(
new FilterList(
FilterList.Operator.MUST_PASS_ALL,
new myCustomFilterA(),
new myCustomFilterB(),
...
)
);