I have a HBase with some apache logs loaded.
I am trying to retrieve a section of logs to analyze using the following
code. I would like all the rows
between column values "DEBUG:xxxxx" and "yyyyy". How can I force scan to
return all these rows? I am using
SingleColumnValueFilter and adding a list which has the filters -
filter1 and filter2.
This code returns the exact row if I use filter1 ("DEBUG:xxxxx") or
filter2 ("yyyyy"),
but does not return any rows if used together in a list. I would like
all the rows between these two rows.
Am I missing something?
Thanks,
Suresh
FilterList list = new FilterList(FilterList.Operator.MUST_PASS_ALL);
RegexStringComparator comp1 = new
RegexStringComparator("DEBUG:xxxxx.");
SingleColumnValueFilter filter1 = new
SingleColumnValueFilter(
Bytes.toBytes("mylogs"), Bytes.toBytes("pcol"),
CompareOp.EQUAL, comp1);
//filter1.setFilterIfMissing(true);
list.addFilter(filter1);
SubstringComparator comp2 = new
SubstringComparator("yyyyy");
SingleColumnValueFilter filter2 = new
SingleColumnValueFilter(
Bytes.toBytes("mylogs"), Bytes.toBytes("pcol"),
CompareOp.EQUAL, comp2);
//filter1.setFilterIfMissing(true);
list.addFilter(filter2);
scan.setFilter(list);
scanner = table.getScanner(scan);
System.out.println("Results of scan:");
for (Result result : scanner) {
for (KeyValue kv :
result.raw()) {
System.out.print("ROW : " + new String(kv.getRow()) + " ");
System.out.print("Family : " + new String(kv.getFamily()) + " ");
System.out.print("Qualifier : " + new String(kv.getQualifier()) + " ");
System.out.println("KV: " + kv + ", Value: "
+ Bytes.toString(kv.getValue()));
}
}
scanner.close();