我正在尝试从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();
}
任何人都可以帮助我。