You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Ding, Hui" <hu...@sap.com> on 2009/03/30 17:46:02 UTC

Order table keys by user defined comparator rather than byte[]

Hi,

Is it possible to order keys of tables by other user defined comparators
rather than the byte[] comparator?
This can give more flexibility and intelligence about data organization
in a table.

Is this functionality already available (I briefly looked at the
packages and couldn't find anything). If not, do you think it makes
sense to add it?

Cheers,
Hui

Re: Order table keys by user defined comparator rather than byte[]

Posted by stack <st...@duboce.net>.
Currently, you can only have one comparator per hbase instance.   You can't
do a comparator per table (or per columnfamily) because all tables come
together in the catalog tables; .META. and -ROOT-.  Here there is an entry
per table region.  If the comparator used sorting rows in the .META. were
different from that used in a particular table, it'd make for odd results.

Since only one comparator, we've no provision for putting in place a
comparator other than the default lexicograhical sort.

That said, it might be possible to change the comparator used as you crossed
tables in the .META. table but its not something we've spent any time on.

If you'd like to pursue this, let us know what you need and we'll make
provision -- adding specification of an alternate comparator to use wouldn't
be hard to do.

St.Ack

On Mon, Mar 30, 2009 at 5:46 PM, Ding, Hui <hu...@sap.com> wrote:

> Hi,
>
> Is it possible to order keys of tables by other user defined comparators
> rather than the byte[] comparator?
> This can give more flexibility and intelligence about data organization
> in a table.
>
> Is this functionality already available (I briefly looked at the
> packages and couldn't find anything). If not, do you think it makes
> sense to add it?
>
> Cheers,
> Hui
>