You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Krishna Kalyan <kr...@gmail.com> on 2014/11/12 06:26:35 UTC

Version in HBase

Hi,
Is it possible to do a
select * from <table_name> where version = "somedate" ; using HBase APIs?.
(Scanning for values where version <= "somedate" )
Could you please direct me to appropriate links to achieve this?.


Regards,
Krishna

Re: Version in HBase

Posted by Krishna Kalyan <kr...@gmail.com>.
Thanks Anoop.
This worked

On Wed, Nov 12, 2014 at 4:50 PM, Anoop John <an...@gmail.com> wrote:

> So you want one version with ts<= give ts?
>
> Have a look at Scan#setTimeRange(long minStamp, long maxStamp)
> If you know the exact ts for cells, you can use Scan#setTimeStamp(long
> timestamp)
>
> -Anoop-
>
> On Wed, Nov 12, 2014 at 11:17 AM, Krishna Kalyan <krishnakalyan3@gmail.com
> >
> wrote:
>
> > For Example for table 'test_table', Values inserted are:
> >
> > Row1 - Val1 => t
> > Row1 - Val2 => t + 3
> > Row1 - Val3 => t + 5
> >
> > Row2 - Val1 => t
> > Row2 - Val2 => t + 3
> > Row2 - Val3 => t + 5
> >
> > on scan 'test_table' where version = t + 4 should return
> > Row1 - Val1 => t + 3
> > Row2 - Val2 => t + 3
> >
> > How do i achieve time stamp based scans?.
> >
> > Thanks and Regards,
> > Krishna
> >
> >
> >
> >
> > On Wed, Nov 12, 2014 at 10:56 AM, Krishna Kalyan <
> krishnakalyan3@gmail.com
> > >
> > wrote:
> >
> > > Hi,
> > > Is it possible to do a
> > > select * from <table_name> where version = "somedate" ; using HBase
> > APIs?.
> > > (Scanning for values where version <= "somedate" )
> > > Could you please direct me to appropriate links to achieve this?.
> > >
> > >
> > > Regards,
> > > Krishna
> > >
> > >
> > >
> >
>

Re: Version in HBase

Posted by Anoop John <an...@gmail.com>.
So you want one version with ts<= give ts?

Have a look at Scan#setTimeRange(long minStamp, long maxStamp)
If you know the exact ts for cells, you can use Scan#setTimeStamp(long
timestamp)

-Anoop-

On Wed, Nov 12, 2014 at 11:17 AM, Krishna Kalyan <kr...@gmail.com>
wrote:

> For Example for table 'test_table', Values inserted are:
>
> Row1 - Val1 => t
> Row1 - Val2 => t + 3
> Row1 - Val3 => t + 5
>
> Row2 - Val1 => t
> Row2 - Val2 => t + 3
> Row2 - Val3 => t + 5
>
> on scan 'test_table' where version = t + 4 should return
> Row1 - Val1 => t + 3
> Row2 - Val2 => t + 3
>
> How do i achieve time stamp based scans?.
>
> Thanks and Regards,
> Krishna
>
>
>
>
> On Wed, Nov 12, 2014 at 10:56 AM, Krishna Kalyan <krishnakalyan3@gmail.com
> >
> wrote:
>
> > Hi,
> > Is it possible to do a
> > select * from <table_name> where version = "somedate" ; using HBase
> APIs?.
> > (Scanning for values where version <= "somedate" )
> > Could you please direct me to appropriate links to achieve this?.
> >
> >
> > Regards,
> > Krishna
> >
> >
> >
>

Re: Version in HBase

Posted by Krishna Kalyan <kr...@gmail.com>.
For Example for table 'test_table', Values inserted are:

Row1 - Val1 => t
Row1 - Val2 => t + 3
Row1 - Val3 => t + 5

Row2 - Val1 => t
Row2 - Val2 => t + 3
Row2 - Val3 => t + 5

on scan 'test_table' where version = t + 4 should return
Row1 - Val1 => t + 3
Row2 - Val2 => t + 3

How do i achieve time stamp based scans?.

Thanks and Regards,
Krishna




On Wed, Nov 12, 2014 at 10:56 AM, Krishna Kalyan <kr...@gmail.com>
wrote:

> Hi,
> Is it possible to do a
> select * from <table_name> where version = "somedate" ; using HBase APIs?.
> (Scanning for values where version <= "somedate" )
> Could you please direct me to appropriate links to achieve this?.
>
>
> Regards,
> Krishna
>
>
>