This is contrary to the behaviour in all databases/column stores I've ever come across. As such I'd view it as a bug.
The logic to change is pretty small (see below). HBase, HSQLDB, SQL Server, and MySQL all implement actual binary sorting.
With this feature, we can't use H2 with MySQL compatibility for testing, and we'll have to stick to HSQLDB.
I guess I could always write a patch :)
M
public static int unsignedByteToInt(byte b) {
return (int) b & FF;
}
public static int compare(final byte[] o1, int offset1, int length1, final byte[] o2, int offset2, int length2) {
final int len = Math.min(length1, length2);
for (int i = 0; i < len; i++) {
byte byte1 = o1[offset1];
byte byte2 = o2[offset2];
if (byte1 != byte2) {
return unsignedByteToInt(byte1) > unsignedByteToInt(byte2) ? 1 : -1;
}
offset1++;
offset2++;
}
final int d = length1 - length2;
return d == 0 ? 0 : (d < 0 ? -1 : 1);