I'm designing an Hbase schema where the row key should be an integer. I intend to use scan API from java with startrow and endrow with integer values.
I guess I can transform my integers in a String with '0'
padding to respect the lexicographical order, but my keys will be much bigger than if I use the binary representation of an integer.
How can I transform my integer (let's say an int
) in byte[]
so that a scan will return the expected values if I use the same transformation for startrow and endrow ?
Answer:
Nils gave the anwser and I found a confirmation here:
Java Comparator for byte array (lexicographic)
Hbase extracts int
from byte[]
and compare them.