You want to check whether one of the conditions is met, right ?

Looking at the second variant of checkAndPut(), HTable uses
BinaryComparator.
I wrote some simple code involving call to BinaryComparator.compareTo().

I had to fix the following:
Caused by: java.lang.NullPointerException

  at
org.apache.hadoop.hbase.filter.ByteArrayComparable.compareTo(ByteArrayComparable.java:85)

with http://pastebin.com/UJ7eJ6zQ

What I found was that comparison to "value".getBytes() and null both gave
positive return value.

FYI

On Fri, Jul 3, 2015 at 2:43 PM, James Young <[email protected]> wrote:

> Hi,
>
> I need to have a checkandput operation for the following condition:
>
> 1: null
> 2: with value less than specified value.
>
>
> I know it has two versions for checkandput and I can implement either
> condition with one of requests. But I don't know how I can check both
> conditions with one atomic call.
>
> Thanks in advance!
>
> James
>
> boolean*checkAndPut
> <
> https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html#checkAndPut(byte[],%20byte[],%20byte[],%20byte[],%20org.apache.hadoop.hbase.client.Put)
> >*(byte[]
> row,
> byte[] family, byte[] qualifier, byte[] value, Put
> <https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Put.html>
>  put)
> Atomically checks if a row/family/qualifier value matches the expected
> value.
> boolean*checkAndPut
> <
> https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HTable.html#checkAndPut(byte[],%20byte[],%20byte[],%20org.apache.hadoop.hbase.filter.CompareFilter.CompareOp,%20byte[],%20org.apache.hadoop.hbase.client.Put)
> >*(byte[]
> row,
> byte[] family, byte[] qualifier, CompareFilter.CompareOp
> <
> https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/filter/CompareFilter.CompareOp.html
> >
> compareOp,
> byte[] value,Put
> <https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Put.html>
>  put)
>

Reply via email to