dbwong 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_r267087618
##########
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 {
Review comment:
In general I dislike this type of many tests in a single junit test as the
failures are non-descriptive and the cases under test are not readable.
----------------------------------------------------------------
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