hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neuron005 <neuron...@gmail.com>
Subject Re: Different value of integer on querying in hbase!
Date Fri, 16 Dec 2011 05:52:45 GMT



Stuart Smith-8 wrote:
> 
> Hello,
>   How did you query base via a statement object? Are you using Hive? 
> 
> Or is this some new interface I don't know about.. I always had to use
> Get() or Scan().
> And hbase stores everything as bytes, not strings.. unlike C, in java,
> there is a difference ;)
> 
> Take care,
>  -stu
> 
> Thanks for your reply Stu
> I am a newbie and thanks to you , you saved me from a big trouble.Hbase
> stores as bytes. So, If I store an integer value, I will have to cast it
> from byte to int. I was using getInt("String") method to read from hbase.
> Or Should I use Scanner ?
> Please tell
> 
> 
> ________________________________
>  From: neuron005 <neuron005@gmail.com>
> To: hbase-user@hadoop.apache.org 
> Sent: Wednesday, December 14, 2011 3:26 AM
> Subject: Different value of integer on querying in hbase!
>  
> 
> Hii there,
> I just created a simple hbase table from my java program, Inserted value
> in
> it. But I got into an issue that whenever I store an integer value in
> habse
> and retrieve it by my java program , It gives a different value.
> For eg. 
> I inserted an int value in my hbase table '1234'
> When I queried from this using my java code -It showed a value  892745528. 
> Though hbase stores everything as string but I casted my result as 
> ResultSet rs=stmt.execute("select * from mapping_name");
> int val2=rs.getInt("val2");//val2 of type string
> 
> Please help me out. Thanks in advance.
> Cheers:working:
> -- 
> View this message in context:
> http://old.nabble.com/Different-value-of-integer-on-querying-in-hbase%21-tp32974072p32974072.html
> Sent from the HBase User mailing list archive at Nabble.com.
> 

-- 
View this message in context: http://old.nabble.com/Different-value-of-integer-on-querying-in-hbase%21-tp32974072p32985019.html
Sent from the HBase User mailing list archive at Nabble.com.


Mime
View raw message