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

Switch to Threaded View
HBase, mail # dev - checkAndPut with comparators


Copy link to this message
-
Re: checkAndPut with comparators
Ted Yu 2013-07-02, 23:42
>From HRegionServer#mutate(), you can find:

          CompareOp compareOp CompareOp.valueOf(condition.getCompareType().name());

          ByteArrayComparable comparator
            ProtobufUtil.toComparator(condition.getComparator());

...

            boolean result = region.checkAndMutate(row, family,

              qualifier, compareOp, comparator, put, true);

WritableByteArrayComparator is no longer used.

Cheers
On Tue, Jul 2, 2013 at 4:11 PM, Rob Roland <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I see that in HBASE-3468, we gained the ability to do a checkAndPut with a
> comparator, but it doesn't look straightforward to use from a client
> perspective.
>
> I'd like to create/submit a patch that would do the following:
>
> Add new WritableByteArrayComparator instances - LongComparator,
> IntComparator, DoubleComparator, FloatComparator, ShortComparator,
> StringComparator. Pretty much helpers for everything that the Bytes class
> can convert to a byte[].
>
> Add a method to HTableInterface / HTable:
>
>     boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
>                         final CompareFilter.CompareOp compareOp,
>                         final WritableByteArrayComparable comparator,
>                         Put put) throws IOException;
>
> and the corresponding delete:
>
>     boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
>                         final CompareFilter.CompareOp compareOp,
>                         final WritableByteArrayComparable comparator,
>                         Delete delete) throws IOException;
>
> Before I get started on that, have I missed anything?
>
> I'm looking at the code in trunk and it's a bit different than the last
> time I submitted a patch, so this is going to take a bit. :)
>
> Thanks,
>
> Rob Roland
>