Thanks all but I'm actually using ruby as my client so there is no Long.MAX_VALUE.

Apparently there is an alternative method...

"These composite row keys are similar to what RDBMSs offer, yet you can control the sort order for each field separately. You could do, for example, *a bitwise inversion of the date expressed as a long value (the Linux epoch)*. This would then sort the rows descending by date"

I just want to be clear on the above statement. A bitwise inversion is simply flipping the bits correct? So if the current time represented as bits is

1001110010011111100101011001110

Then the bitwise inversion is

0110001101100000011010100000110

Is this correct?


On 8/20/11 7:10 AM, [email protected] wrote:
I use this bit from the link sent by Sonal:
reverse_order_stamp is an 8 byte, big endian long with a value of 
(Long.MAX_VALUE - epoch).  This is so the most recent stamp is at the top 
rather than the bottom.

I use (Long.MAX_VALUE - System.getCurrentTimeMillis()).

-Steve

-----Original Message-----
From: Mark [mailto:[email protected]]
Sent: Saturday, August 20, 2011 6:29 AM
To: [email protected]
Subject: Re: Reverse timestamp

Thanks but I was more referring to reverse ordered timestamps for
composite keys to be used for sorting purposes.

On 8/19/11 10:26 PM, lars hofhansl wrote:
HBase maps (row-key, column family name, column, timestamp) to a value.

The KeyValues are also sorted by the same attributes in reverse timestamp order.

The default timestamp is the current time, but you can set any long value 
(which does not need correlate in any way to the time domain)
as the time stamp and hence define your own ordering within multiple version of 
the same row key.

See Put: Put(byte[] row, long ts).

Is that what you meant?

-- Lars



________________________________
From: Mark<[email protected]>
To: [email protected]
Sent: Friday, August 19, 2011 6:39 PM
Subject: Reverse timestamp

I understand the need but I don't understand how to generate a reverse 
timestamp. Can someone please explain how this is accomplished and how I can 
test that its working correctly?

Thanks

Reply via email to