Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> Query a version of a column efficiently


Copy link to this message
-
Re: Query a version of a column efficiently
Somebody will correct me if I'm wrong, but I think that for your
example, you should use setTimeRange(0, 5) and setMaxVersion(1).  It's
my understanding that those settings will give you the 1 latest
version from all applicable version (0 <= timestamp <= 5).

Since it's pretty easy to set the timestamp of a row when you update
it, try it, and see if it's what you want.

--Tom

On Thu, Jul 26, 2012 at 3:40 PM, Jerry Lam <[EMAIL PROTECTED]> wrote:
> Hi St.Ack:
>
> Let say there are 5 versions for a column A with timestamp = [0, 1, 3, 6,
> 10].
> I want to execute an efficient query that returns one version of the column
> that has a timestamp that is equal to 5 or less. So in this case, it should
> return the value of the column A with timestamp = 3.
>
> Using the setTimeRange(5,  Long.MAX_VALUE) with setMaxVersion = 1, my guess
> is that it will return the version 6 not version 3. Correct me if I'm
> wrong.
>
> Best Regards,
>
> Jerry
>
> On Thu, Jul 26, 2012 at 5:13 PM, Stack <[EMAIL PROTECTED]> wrote:
>
>> On Thu, Jul 26, 2012 at 7:43 PM, Jerry Lam <[EMAIL PROTECTED]> wrote:
>> > I need some advises on a problem that I'm facing using HBase. How can I
>> > efficiently query a version of a column when I don't know exactly the
>> > version I'm looking for?
>> > For instance, I want to query a column with timestamp that is less or
>> equal
>> > to N, if version = N is available, return it to me. Otherwise, I want the
>> > version that is closest to the version N (order by descending of
>> > timestamp). That is if version = N - 1 exists, I want it to be returned.
>> >
>>
>> Have you tried a timerange w/ minStamp of N and maxStamp of
>> HConstants#LATEST_TIMESTAMP Long.MAX_VALUE) returning one version only
>> (setMaxVersion(1))?
>>
>> St.Ack
>>