You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by mac fang <ma...@gmail.com> on 2011/09/19 11:03:11 UTC

Issue about the hbase.client.Scan

Hi, Guys,

When I use the client.Scan class to get a set of rows back from
RegionServer, i found one interesting code, the script i used is like:

        Scan scan = new Scan(Bytes.toBytes("a"), Bytes.toBytes("f"));
>         scan.addColumn(famA, col1);
>         scan.setCaching(1);
>         scan.setBatch(1);
>
>        ......
>
>
>           FilterList filter = new FilterList(Operator.MUST_PASS_ONE,
>                 Arrays.asList((Filter) singleColumnValueFilterA,
>                         singleColumnValueFilterB));
>         scan.setFilter(filter);
>

The code of scan.setBatch(1); is

  /**
>    * Set the maximum number of values to return for each call to next()
>    * @param batch the maximum number of values
>    */
>   public void setBatch(int batch) {
>     if(this.hasFilter() && this.filter.hasFilterRow()) {
>       throw new IncompatibleFilterException(
>         "Cannot set batch on a scan using a filter" +
>         " that returns true for filter.hasFilterRow");
>     }
>     this.batch = batch;
>   }
>


So Obveriously, the Exception will NOT set since the invokation of setFilter
is later than setBatch. I think it is a bug.

Second question, i did NOT see any usage of the batch. Instead, i see the
usage of setCache - it will get a set of results back from server in one
time RPC. Something i miss?

regards
macf

Re: Issue about the hbase.client.Scan

Posted by Stack <st...@duboce.net>.
On Mon, Sep 19, 2011 at 2:03 AM, mac fang <ma...@gmail.com> wrote:
> So Obveriously, the Exception will NOT set since the invokation of setFilter
> is later than setBatch. I think it is a bug.
>

Yes.

Mind filing an issue (and perhaps a patch?)?

> Second question, i did NOT see any usage of the batch. Instead, i see the
> usage of setCache - it will get a set of results back from server in one
> time RPC. Something i miss?
>

See in RegionScanner on server-side where we do getBatch to bound how
many results we return in the one go.

St.Ack