I just realized that using the increment function creates another version,
with a new timestamp.
Is there a way we can use the previous TS, hence over writing the value ?

On Tue, Mar 29, 2011 at 9:38 AM, sulabh choudhury <sula...@gmail.com> wrote:

> Thanks Jesse. Changing the 10 to 10L made it work.
>
> On Tue, Mar 29, 2011 at 8:59 AM, Jesse Hutton <jesse.hut...@gmail.com>wrote:
>
>> Hi,
>>
>> It looks like the problem is that the initial value you're inserting in
>> the column is an int, while HTable#incrementColumnValue() expects a long.
>> Instead of:
>>
>>
>>> I enter data by :-
>>> theput.add(Bytes.toBytes("uid"),Bytes.toBytes("1"), 1301087829999L + t,
>>> Bytes.toBytes(10))
>>>
>>
>> try:
>> theput.add(Bytes.toBytes("uid"),Bytes.toBytes("1"), 1301087829999L + t,
>> Bytes.toBytes(10L));
>>
>> Jesse
>>
>>
>>>
>>> Now when I try to increment the value I have tried...
>>> mytable.incrementColumnValue(Bytes.toBytes("row5"),
>>> Bytes.toBytes("uid"),Bytes.toBytes("1"),Bytes.toBytes(1))
>>> mytable.incrementColumnValue(Bytes.toBytes("row5"),
>>> Bytes.toBytes("uid"),Bytes.toBytes("1"),1)
>>>
>>> also
>>> val inc = new Increment(Bytes.toBytes("row" + 5))
>>> inc.addColumn(Bytes.toBytes("uid"),Bytes.toBytes("1"),1)
>>> mytable.increment(inc)
>>>
>>> In both of the cases, I get an error like
>>> org.apache.hadoop.hbase.client.RetriesExhaustedException:
>>> Exceptions:
>>> java.io.IOException: java.io.IOException:
>>> java.lang.IllegalArgumentException: offset (28) + length (8) exceed the
>>> capacity of the array: 32
>>> at
>>>
>>> org.apache.hadoop.hbase.util.Bytes.explainWrongLengthOrOffset(Bytes.java:502)
>>>  at org.apache.hadoop.hbase.util.Bytes.toLong(Bytes.java:480)
>>> at
>>>
>>> org.apache.hadoop.hbase.regionserver.HRegion.incrementColumnValue(HRegion.java:3134)
>>>  at
>>>
>>> org.apache.hadoop.hbase.regionserver.HRegionServer.incrementColumnValue(HRegionServer.java:2486)
>>> at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
>>>  at sun.reflec...
>>>
>>>
>>> I guess I have tried all possible combinations of datatypes....I could
>>> not
>>> even find a decent example of incrementColumnValue()
>>>
>>
>>
>
>
>
>

Reply via email to