in java/kudu-client/src/main/java/org/apache/kudu/client/KuduPredicate.java [1031:1089]
private boolean areConsecutive(byte[] a, byte[] b) {
switch (column.getType().getDataType(column.getTypeAttributes())) {
case BOOL: return false;
case INT8: {
byte m = Bytes.getByte(a);
byte n = Bytes.getByte(b);
return m < n && m + 1 == n;
}
case INT16: {
short m = Bytes.getShort(a);
short n = Bytes.getShort(b);
return m < n && m + 1 == n;
}
case INT32:
case DATE:
case DECIMAL32: {
int m = Bytes.getInt(a);
int n = Bytes.getInt(b);
return m < n && m + 1 == n;
}
case INT64:
case UNIXTIME_MICROS:
case DECIMAL64: {
long m = Bytes.getLong(a);
long n = Bytes.getLong(b);
return m < n && m + 1 == n;
}
case FLOAT: {
float m = Bytes.getFloat(a);
float n = Bytes.getFloat(b);
return m < n && Math.nextAfter(m, Float.POSITIVE_INFINITY) == n;
}
case DOUBLE: {
double m = Bytes.getDouble(a);
double n = Bytes.getDouble(b);
return m < n && Math.nextAfter(m, Double.POSITIVE_INFINITY) == n;
}
case STRING:
case VARCHAR:
case BINARY: {
if (a.length + 1 != b.length || b[a.length] != 0) {
return false;
}
for (int i = 0; i < a.length; i++) {
if (a[i] != b[i]) {
return false;
}
}
return true;
}
case DECIMAL128: {
BigInteger m = Bytes.getBigInteger(a);
BigInteger n = Bytes.getBigInteger(b);
return m.compareTo(n) < 0 && m.add(BigInteger.ONE).equals(n);
}
default:
throw new IllegalStateException(String.format("unknown column type %s", column.getType()));
}
}