4 ms·
Many users of HBase (including ourselves) use different, more efficient encoding of values into byte arrays than converting them to String's first, then byte ar
by ddlatham 16y ago
Many users of HBase (including ourselves) use different, more efficient encoding of values into byte arrays than converting them to String's first, then byte arrays. For example, it's common to use protobuf to encode an object into a byte array for storage in HBase.
Rather than have 2 copies of all the api methods (one for people storing just Strings, and one for arbitrary byte arrays), it's simpler to have a single call and let the caller use the Bytes.toBytes method if they want to store a String.
- biot 16y agoThat makes sense for the values, but the names of rows and columns are also passed as bytes. Wouldn't a convenience function that accepts strings, performs the Bytes.toBytes() conversion and calls the original method reduce code clutter?
- ddlatham 16y agoThe same thing applies to rows and columns. We don't use any simple strings for our row or column indexes. They are serialized objects. Earlier versions of the API actually did have String based versions, and were changed to just byte arrays to reduce clutter.
- biot 16y agoInteresting, that makes sense then.
- nivertech 16y agoIt looks like HBase developers were working hard to design the most verbose API possible ;)