hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harsh J <ha...@cloudera.com>
Subject Re: checkAndPut behavior question
Date Wed, 28 Dec 2011 02:42:03 GMT
Hey Joe,

Perhaps in spirit of http://xkcd.com/979/ you'd like to share the answer as well, for folks
who won't immediately understand what the problem was? :)

On 28-Dec-2011, at 3:37 AM, Joe Stein wrote:

> figured this one out too, never mind.
> 
> hoping to publish a getting started for scala devs with relative functions
> in a tes framework and the rest, lowering the curve to getting going
> 
> cheers
> 
> On Tue, Dec 27, 2011 at 3:50 PM, Joe Stein
> <charmalloc@allthingshadoop.com>wrote:
> 
>> So I have this code which when runs is doing what I expect from a new row
>> 
>>    val table = new HTable(conf, "mytable")
>> 
>>    val theput= new Put(Bytes.toBytes("rowkey1"))
>> 
>> 
>> theput.add(Bytes.toBytes("ids"),Bytes.toBytes("id2"),Bytes.toBytes("one"))
>> 
>>    println("check and put 1" +
>> table.checkAndPut(Bytes.toBytes("rowkey1"),Bytes.toBytes("ids"),Bytes.toBytes("id2"),null,theput))
>> 
>>    println("check and put 2" +
>> table.checkAndPut(Bytes.toBytes("rowkey1"),Bytes.toBytes("ids"),Bytes.toBytes("id2"),null,theput))
>> 
>> check and put 1true
>> check and put 2false
>> 
>> when I run my test app again, I would expect false and false (since the
>> row already has the column there)
>> 
>> check and put 1true
>> check and put 2false
>> 
>> I don't understand I thought it would be
>> 
>> check and put 1false
>> check and put 2false
>> 
>> hbase(main):012:0> scan 'mytable'
>> ROW                                                 COLUMN+CELL
>> 
>> 
>> rowkey1                                            column=ids:id2,
>> timestamp=1325018846038, value=one
>> 
>> 1 row(s) in 1.1010 seconds
>> 
>> 
>> --
>> 
>> /*
>> Joe Stein
>> http://www.linkedin.com/in/charmalloc
>> Twitter: @allthingshadoop <http://twitter.com/#!/allthingshadoop>
>> */
>> 
> 
> 
> 
> -- 
> 
> /*
> Joe Stein
> http://www.linkedin.com/in/charmalloc
> Twitter: @allthingshadoop <http://twitter.com/#!/allthingshadoop>
> */


Mime
View raw message