I tried that, it didn't work. I thought GREATER and LESS operators will
not
work for StringComparator.

I would like to use startRow() and stopRow() on a scan, but these
operations
are based on plain Strings and not regular expressions like I want.

Suresh

-----Original Message-----
From: Norbert Burger [mailto:[email protected]] 
Sent: Monday, October 15, 2012 5:18 PM
To: [email protected]
Subject: Re: Retrieving rows with specific values using
SinglieColumnValueFilter

Try changing your CompareOp.EQUALs to CompareOp.GREATER_OR_EQUAL and
CompareOp.LESS_OR_EQUAL, respectively.  You want all rows between your
two key.

Norbert

On Mon, Oct 15, 2012 at 7:00 PM, Kumar, Suresh <[email protected]>
wrote:
> 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();
>

Reply via email to