You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Rajeshkumar J <ra...@gmail.com> on 2016/01/04 07:46:06 UTC

Type of filter to use

Hi,

  I have designed my row key as yyyy-mm-dd| platform | control and the
column values are the ids of the customers who visited the respective
platform and control on a particular day.
  For instance
2016-01-01 | Bigdata | Bigdata       1002,20005,3009

Now we have a combo box through which we can choose any date, platform and
control values.

if they choose these three values we can match the row key easily and
retrieve records. what if they chose only platform or control or date
values what type of filter do i have to use for this scenario

Thanks

Re: Type of filter to use

Posted by Rajeshkumar J <ra...@gmail.com>.
Hi Tariq,

    I have tried rowfilter both with substring and regex filter it is very
slow  but i need data retrieval to be less than 3 seconds.

Thanks

On Mon, Jan 4, 2016 at 4:33 PM, Mohammad Tariq <do...@gmail.com> wrote:

> Hi Rajesh,
>
> To begin with I would suggest you to rethink about your key design. If you
> are getting a lot of data(which I assume you do) then this type of keys
> could lead you to region hotspotting
> <https://issues.apache.org/jira/browse/HBASE-11682>.
>
> Coming back to your original question you could also use row filter with
> substring comparator.
>
>
> [image: http://]
> Tariq, Mohammad
> about.me/mti
> [image: http://]
> <http://about.me/mti>
>
>
> On Mon, Jan 4, 2016 at 4:08 PM, Rajeshkumar J <rajeshkumarit8292@gmail.com
> >
> wrote:
>
> > Hi,
> >
> >   For the above query i decided to use fuzzy rowfilter as of now. we can
> > use fuzzy row filter when rowkey has fixed length. For the above query i
> > decided to design row key as yyyy-mm-dd| platform id | control id where
> > platform id and control id are a two digit nos.
> > So now actions can be performed by yyyy-mm-dd|??|?? and so on.
> >
> >   Now i am trying to use fuzzy row filter in java api and i tried below
> > code but it throws error.
> >
> >
> >         Configuration config = HBaseConfiguration.create();
> >
> >
> >         HTable hTable = new HTable(config, "test");
> >
> >         Scan scan = new Scan();
> >
> >         scan.setFilter(new FuzzyRowFilter(
> >                 Arrays.asList(
> >                         new Pair<byte[], byte[]>(
> >
> > Bytes.toBytesBinary("\\x00\\x00\\x00\\x00_login_"),
> >                                 new byte[]{1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
> > 0}))));
> >     }
> >
> >
> > I have added all the dependency jars but still it throws Create
> constructor
> > " FuzzyRowFilter(java.util.list) " and i am using hbase version 0.98.13
> >
> > Can any one help me in solving this?
> >
> >
> > Thanks
> >
> > On Mon, Jan 4, 2016 at 12:16 PM, Rajeshkumar J <
> > rajeshkumarit8292@gmail.com>
> > wrote:
> >
> > > Hi,
> > >
> > >   I have designed my row key as yyyy-mm-dd| platform | control and the
> > > column values are the ids of the customers who visited the respective
> > > platform and control on a particular day.
> > >   For instance
> > > 2016-01-01 | Bigdata | Bigdata       1002,20005,3009
> > >
> > > Now we have a combo box through which we can choose any date, platform
> > and
> > > control values.
> > >
> > > if they choose these three values we can match the row key easily and
> > > retrieve records. what if they chose only platform or control or date
> > > values what type of filter do i have to use for this scenario
> > >
> > > Thanks
> > >
> >
>

Re: Type of filter to use

Posted by Mohammad Tariq <do...@gmail.com>.
Hi Rajesh,

To begin with I would suggest you to rethink about your key design. If you
are getting a lot of data(which I assume you do) then this type of keys
could lead you to region hotspotting
<https://issues.apache.org/jira/browse/HBASE-11682>.

Coming back to your original question you could also use row filter with
substring comparator.


[image: http://]
Tariq, Mohammad
about.me/mti
[image: http://]
<http://about.me/mti>


On Mon, Jan 4, 2016 at 4:08 PM, Rajeshkumar J <ra...@gmail.com>
wrote:

> Hi,
>
>   For the above query i decided to use fuzzy rowfilter as of now. we can
> use fuzzy row filter when rowkey has fixed length. For the above query i
> decided to design row key as yyyy-mm-dd| platform id | control id where
> platform id and control id are a two digit nos.
> So now actions can be performed by yyyy-mm-dd|??|?? and so on.
>
>   Now i am trying to use fuzzy row filter in java api and i tried below
> code but it throws error.
>
>
>         Configuration config = HBaseConfiguration.create();
>
>
>         HTable hTable = new HTable(config, "test");
>
>         Scan scan = new Scan();
>
>         scan.setFilter(new FuzzyRowFilter(
>                 Arrays.asList(
>                         new Pair<byte[], byte[]>(
>
> Bytes.toBytesBinary("\\x00\\x00\\x00\\x00_login_"),
>                                 new byte[]{1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
> 0}))));
>     }
>
>
> I have added all the dependency jars but still it throws Create constructor
> " FuzzyRowFilter(java.util.list) " and i am using hbase version 0.98.13
>
> Can any one help me in solving this?
>
>
> Thanks
>
> On Mon, Jan 4, 2016 at 12:16 PM, Rajeshkumar J <
> rajeshkumarit8292@gmail.com>
> wrote:
>
> > Hi,
> >
> >   I have designed my row key as yyyy-mm-dd| platform | control and the
> > column values are the ids of the customers who visited the respective
> > platform and control on a particular day.
> >   For instance
> > 2016-01-01 | Bigdata | Bigdata       1002,20005,3009
> >
> > Now we have a combo box through which we can choose any date, platform
> and
> > control values.
> >
> > if they choose these three values we can match the row key easily and
> > retrieve records. what if they chose only platform or control or date
> > values what type of filter do i have to use for this scenario
> >
> > Thanks
> >
>

Re: Type of filter to use

Posted by Rajeshkumar J <ra...@gmail.com>.
Hi,

  For the above query i decided to use fuzzy rowfilter as of now. we can
use fuzzy row filter when rowkey has fixed length. For the above query i
decided to design row key as yyyy-mm-dd| platform id | control id where
platform id and control id are a two digit nos.
So now actions can be performed by yyyy-mm-dd|??|?? and so on.

  Now i am trying to use fuzzy row filter in java api and i tried below
code but it throws error.


        Configuration config = HBaseConfiguration.create();


        HTable hTable = new HTable(config, "test");

        Scan scan = new Scan();

        scan.setFilter(new FuzzyRowFilter(
                Arrays.asList(
                        new Pair<byte[], byte[]>(

Bytes.toBytesBinary("\\x00\\x00\\x00\\x00_login_"),
                                new byte[]{1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
0}))));
    }


I have added all the dependency jars but still it throws Create constructor
" FuzzyRowFilter(java.util.list) " and i am using hbase version 0.98.13

Can any one help me in solving this?


Thanks

On Mon, Jan 4, 2016 at 12:16 PM, Rajeshkumar J <ra...@gmail.com>
wrote:

> Hi,
>
>   I have designed my row key as yyyy-mm-dd| platform | control and the
> column values are the ids of the customers who visited the respective
> platform and control on a particular day.
>   For instance
> 2016-01-01 | Bigdata | Bigdata       1002,20005,3009
>
> Now we have a combo box through which we can choose any date, platform and
> control values.
>
> if they choose these three values we can match the row key easily and
> retrieve records. what if they chose only platform or control or date
> values what type of filter do i have to use for this scenario
>
> Thanks
>