You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by James Johansville <ja...@gmail.com> on 2016/04/28 00:36:17 UTC

Question on writing scan coprocessors

Hello,

I'd like to write a similar coprocessor to the example
RegionObserverExample at
http://www.3pillarglobal.com/insights/hbase-coprocessors  : that is, a scan
coprocessor which intercepts and selectively filters scan results.

My problem is, I need to be able to filter out Results based on a Scan
attribute. preScannerNext() as used in above example does not allow for
this, as Scan object is not passed down to the method.

Any guidance on how to accomplish this?

Thanks,
James

Re: Question on writing scan coprocessors

Posted by Anoop John <an...@gmail.com>.
Different ways there for you to achieve

1. preScannerOpen -> Here u will get Scan object. You can add a new
Filter into the Scan  object and pass the Scan object (or the
attribute you look for) into this Filter.  The later scan op will use
this Filter and within that u can do filter of cells.

2. postScannerOpen -> Use this hook.  Here the RegionScanner is
already been made and u will get it passed to this hook. Also u have
the Scan object.  Create a wrapper for the scanner and return that
wrapper object from this hook.. Within the wrapper u can pass the Scan
attribute.   Use the wrapped scanner instance for the real next()
ops..  On the returned cells do the filtering ops



-Anoop-




On Thu, Apr 28, 2016 at 4:06 AM, James Johansville
<ja...@gmail.com> wrote:
> Hello,
>
> I'd like to write a similar coprocessor to the example
> RegionObserverExample at
> http://www.3pillarglobal.com/insights/hbase-coprocessors  : that is, a scan
> coprocessor which intercepts and selectively filters scan results.
>
> My problem is, I need to be able to filter out Results based on a Scan
> attribute. preScannerNext() as used in above example does not allow for
> this, as Scan object is not passed down to the method.
>
> Any guidance on how to accomplish this?
>
> Thanks,
> James