Hi Jeff,

Do what is best for the most common use you anticipate will happen on query or 
scan. Are you going to be most often displaying the value as a string? If so, 
store as string via Bytes.toBytes(String). Or are you most often going to 
perform some integer arithmetic or some other operation on bits? Then store via 
Bytes.toBytes(long) -- bits will go into the byte array in big endian order. 
The latter is more compact and generic, to my mind, so that is what I would 
use. 

   - Andy




________________________________
From: Jeff Zhang <zjf...@gmail.com>
To: hbase-user@hadoop.apache.org
Sent: Sun, November 15, 2009 7:05:23 PM
Subject: What type should I choose ?

Hi all,

I know that the value in hbase is just a byte array. So before I put any
type of data, I should convert it to bytes.

But I found that if I convert String to bytes, I can see the real value in
hbase shell, while If I convert long to bytes, I will see byte array in
hbase shell which is not intuitive.

So I'd like to know what's difference between different types if there any
performance problem if I use the string type instead of long type ? (
convert each long into string first and then convert it to bytes).



Thank you.

Jeff Zhang



      

Reply via email to