What type should I choose ?

2009-11-15 Thread Jeff Zhang
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

Re: What type should I choose ?

2009-11-15 Thread Andrew Purtell
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

Re: What type should I choose ?

2009-11-15 Thread Ryan Rawson
Another thing to remember, that if you are using the ASCII expansion of a integer as a key, it is sorted in _lexographic_ order which is not numerical order. For example you'll get this ordering in ASCII: 1 12 2 ... You either have to pad with leading 0s, or use big-endian byte "conversion". Eg: