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

Switch to Plain View
HBase >> mail # dev >> checkAndPut with comparators


+
Rob Roland 2013-07-02, 23:11
+
Ted Yu 2013-07-02, 23:42
+
Rob Roland 2013-07-02, 23:47
Copy link to this message
-
Re: checkAndPut with comparators
Under hbase-protocol directory, run the following for the .proto file:

protoc -Isrc/main/protobuf --java_out=src/main/java $PROTO_FILE

See the hbase-protocol/src/main/protobuf/README.txt

Cheers

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

> Ahh, okay. Sounds like the rest still applies, though, with wanting to
> expose this to the client APIs in an easier-to-use fashion?
>
> I'd also want to backport this patch to the 0.94.x series so I could
> actually use it in production also :)
>
> I do see the ComparatorProtos (and the various .proto files) in the
> hbase-protocol submodule. Is there a trick to regenerating them? Do I just
> need to run protoc manually? Not an issue if that's the case. I wired up my
> Maven pom in an internal project to call protoc for me during a build.
>
> Thanks,
>
> Rob
>
> On Tue, Jul 2, 2013 at 4:42 PM, Ted Yu <[EMAIL PROTECTED]> wrote:
>
> > 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
> > >
> >
>
+
Stack 2013-07-03, 18:12