BinShi-SecularBird commented on a change in pull request #471: PHOENIX-5176
KeyRange.compareUpperRange(KeyRang 1, KeyRang 2) returns wrong result when two
key ranges have the same upper bound values but one is inclusive and another is
exclusive
URL: https://github.com/apache/phoenix/pull/471#discussion_r267902225
##########
File path:
phoenix-core/src/test/java/org/apache/phoenix/query/KeyRangeMoreTest.java
##########
@@ -192,64 +193,78 @@ public void testListIntersectForBoundary() throws
Exception {
listIntersectAndAssert(Arrays.asList(KeyRange.EMPTY_RANGE),Arrays.asList(KeyRange.EVERYTHING_RANGE),Arrays.asList(KeyRange.EMPTY_RANGE));
- rowKeyRanges1=Arrays.asList(
- PInteger.INSTANCE.getKeyRange(
- PInteger.INSTANCE.toBytes(2),
- true,
- PInteger.INSTANCE.toBytes(5),
- true),
- PInteger.INSTANCE.getKeyRange(
- PInteger.INSTANCE.toBytes(8),
- true,
- KeyRange.UNBOUND,
- false));
- rowKeyRanges2=Arrays.asList(
- PInteger.INSTANCE.getKeyRange(
- KeyRange.UNBOUND,
- false,
- PInteger.INSTANCE.toBytes(4),
- true),
- PInteger.INSTANCE.getKeyRange(
- PInteger.INSTANCE.toBytes(7),
- true,
- PInteger.INSTANCE.toBytes(10),
- true),
- PInteger.INSTANCE.getKeyRange(
- PInteger.INSTANCE.toBytes(13),
- true,
- PInteger.INSTANCE.toBytes(14),
- true),
- PInteger.INSTANCE.getKeyRange(
- PInteger.INSTANCE.toBytes(19),
- true,
- KeyRange.UNBOUND,
- false)
- );
- expected=Arrays.asList(
- PInteger.INSTANCE.getKeyRange(
- PInteger.INSTANCE.toBytes(2),
- true,
- PInteger.INSTANCE.toBytes(4),
- true),
- PInteger.INSTANCE.getKeyRange(
- PInteger.INSTANCE.toBytes(8),
- true,
- PInteger.INSTANCE.toBytes(10),
- true),
- PInteger.INSTANCE.getKeyRange(
- PInteger.INSTANCE.toBytes(13),
- true,
- PInteger.INSTANCE.toBytes(14),
- true),
- PInteger.INSTANCE.getKeyRange(
- PInteger.INSTANCE.toBytes(19),
- true,
- KeyRange.UNBOUND,
- false)
- );
+ rowKeyRanges1 = CreateKeyRangeList(
+ Arrays.asList(2, 5, 8, Integer.MAX_VALUE),
+ Arrays.asList(true, true, true, false));
+ rowKeyRanges2 = CreateKeyRangeList(
+ Arrays.asList(Integer.MIN_VALUE, 4, 7, 10, 13, 14, 19,
Integer.MAX_VALUE),
+ Arrays.asList(false, true, true, true, true, true, true,
false));
+ expected = CreateKeyRangeList(
+ Arrays.asList(2, 4, 8, 10, 13, 14, 19, Integer.MAX_VALUE),
+ Arrays.asList(true, true, true, true, true, true, true,
false));
+ listIntersectAndAssert(rowKeyRanges1, rowKeyRanges2, expected);
+
+ rowKeyRanges1 = CreateKeyRangeList(
+ Arrays.asList(3, 5, 5, 6),
+ Arrays.asList(true, false, true, false));
+ rowKeyRanges2 = CreateKeyRangeList(
+ Arrays.asList(3, 5, 6, 7),
+ Arrays.asList(true, true, true, true));
+ expected = CreateKeyRangeList(
+ Arrays.asList(3, 5),
+ Arrays.asList(true, true));
listIntersectAndAssert(rowKeyRanges1, rowKeyRanges2, expected);
}
+ @Test
+ public void testKeyRangeCompareUpperRange() throws Exception {
+ List<KeyRange> rowKeyRanges1 = CreateKeyRangeListWithFixedLowerRange(
+ Arrays.asList(Integer.MAX_VALUE, Integer.MAX_VALUE, 10000,
1001, 1000, 1000, 1000, 1000),
+ Arrays.asList(false, false, true, true, true, true, false,
true));
+ List<KeyRange> rowKeyRanges2 = CreateKeyRangeListWithFixedLowerRange(
Review comment:
It is not necessary. It doesn't test more after the strings being covered to
bytes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services