Description
In KeyRange.java,
public static int compareUpperRange(KeyRange rowKeyRange1, KeyRange rowKeyRange2) {
int result = Boolean.compare(rowKeyRange1.upperUnbound(), rowKeyRange2.upperUnbound());
if (result != 0) {
return result;
}
result = Bytes.BYTES_COMPARATOR.compare(rowKeyRange1.getUpperRange(), rowKeyRange2.getUpperRange());
if (result != 0) {
return result;
}
return Boolean.compare(rowKeyRange2.isUpperInclusive(), rowKeyRange1.isUpperInclusive());
}
The last line in yellow color should be "return Boolean.compare(rowKeyRange1.isUpperInclusive(), rowKeyRange2.isUpperInclusive());". Given rowKeyRange1 [3, 5) and rowKeyRange2 [3, 5], the function should return -1, but now it returns 1 due to the bug I mentioned.
The KeyRange.compareUpperRange is only used in KeyRange.intersect(List<KeyRange> rowKeyRanges1, List<KeyRange> rowKeyRanges2). Given rowKeyRanges1 {[3, 5), [5, 6)} and rowKeyRanges2{[3, 5], [6, 7]}, the function should return {[3, 5), [5, 5]}, i.e., {[3, 5]}, but it seems that now it returns {[3,5)} due to the bug.
Attachments
Issue Links
- links to