hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Purtell <apurt...@apache.org>
Subject Re: What type should I choose ?
Date Mon, 16 Nov 2009 03:35:06 GMT
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 <zjffdu@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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message