我正在尝试从hbase中筛选一些数据它是一个measuretimestamp作为字符串。过滤值超出我的过滤范围;这是我的密码:
try {
FilterList filters = new FilterList();
Filter filter = new SingleColumnValueFilter(
Bytes.toBytes("measure"),
Bytes.toBytes("measureTimestamp"),
CompareOp.GREATER_OR_EQUAL,
Bytes.toBytes("0000000100")); // ??column1???aaa?????
filters.addFilter(filter);
Filter filter1 = new SingleColumnValueFilter(
Bytes.toBytes("measure"),
Bytes.toBytes("measureTimestamp"),
CompareOp.LESS_OR_EQUAL,
Bytes.toBytes("0000015000"));
filters.addFilter(filter1);
Filter filter2 = new SingleColumnValueFilter(
Bytes.toBytes("measure"),
Bytes.toBytes("captor_id"),
CompareOp.EQUAL,
new BinaryComparator(Bytes.toBytes("2")));
filters.addFilter(filter2);
Scan scan = new Scan();
scan.setFilter(filters);
rs = table.getScanner(scan);
for (Result r: rs) {
System.out.println("Cle Ligne :" + new String(r.getRow()));
for (KeyValue keyValue: r.raw()) {
System.out.println("-" + new String(keyValue.getQualifier()) + " = : " + new String(keyValue.getValue()));
}
}
rs.close();
} catch (IOException e) {
e.printStackTrace();
}
谁能帮我一下吗。
暂无答案!
目前还没有任何答案,快来回答吧!