【发布时间】:2021-04-30 00:58:55
【问题描述】:
我的 hbase 表中有这一行: {rowkey:1_1611646861574/cf:value/1611646776287/Put/vlen=8/seqid=0} 现在我想做一个简单的扫描并找到其列值大于“1611388300000”的行。但它不返回任何记录;但是,当我使用 LESS_OR_EQUAL 而不是 1611647500000 时,它会返回此记录。 奇怪的是我可以从 apache phoenix sql 查询中得到这条记录:select * from my_table where value>=1611388300000.
所以数字明显大于列值,apache phoenix 返回它;为什么 hbase compare Operator 没有?
这是我的代码:
Table table = con.getTable(TableName.valueOf("my_table"));
Scan scan = new Scan();
scan.addColumn(Bytes.toBytes("cf"), Bytes.toBytes("value"));
FilterList flist = new FilterList(FilterList.Operator.MUST_PASS_ALL);
flist.addFilter(new PrefixFilter(Bytes.toBytes("1")));
flist.addFilter(new SingleColumnValueFilter(
Bytes.toBytes("cf"), Bytes.toBytes("value"), CompareOperator.GREATER_OR_EQUAL,
new BinaryComparator(Bytes.toBytes("1611388300000"))));
scan.setFilter(flist);
ResultScanner scanner = table.getScanner(scan);
for (Result result = scanner.next(); result != null; result = scanner.next())
System.out.println("Found row : " + result);
scanner.close();
【问题讨论】:
标签: java hadoop bigdata hbase phoenix