There are indeed a number of toBytes(...) overloads, like Ryan said. When you have a fixed record type like this, using Bytes.toBytes(...) is likely the simplest and most compact thing to do. Protobuf and Avro are nice if you have records with optional fields or want to mix different types of records in one table. Also if you have records that may change over time (adding fields, etc.).
Friso On 26 jan 2011, at 11:36, Eric wrote: > I've been looking at Avro and Protocol Buffers too. I'm storing multiple > properties, like a Tweet that has a user id, timestamp, message, etc. I > actually thought toBytes() would convert to string and then to bytes (stupid > assumtion). I think I´ll convert my Strings to the proper format (int's, > longs) and then use toBytes() because protobufs and Avro add too much > complexity in this case. > > 2011/1/26 Friso van Vollenhoven <[email protected]> > >> We are using protobuf (http://code.google.com/apis/protocolbuffers/). >> That's not by any means a recommendation, just a possibility. What is your >> use case? >> >> Friso >> >> >> >> On 26 jan 2011, at 10:47, Eric wrote: >> >> I'm wondering what the best way is to store my data in HBase. I'm currently >> converting everything to a string and then to a bytes array. >> What are others doing? Plain text to to byte arrays and eventually convert >> your data back to floats, int, etcetera? >> >>
