apurtell commented on code in PR #2657:
URL: https://github.com/apache/phoenix/pull/2657#discussion_r4472421073
##########
phoenix-core/src/test/java/org/apache/phoenix/util/ByteUtilTest.java:
##########
@@ -65,4 +66,29 @@ public void testNextKey() {
key = new byte[] { (byte) 255 };
assertNull(ByteUtil.nextKey(key));
}
+
+ @Test
+ public void testLargestPossibleRowKeyInRangeWithEmptyEndKey() {
+ byte[][] startKeys = new byte[][] { Bytes.toBytes("t0005"), new byte[] {
(byte) 0x80, 0, 0 },
+ new byte[] { 0 }, new byte[] { (byte) 255, (byte) 255 } };
+ for (byte[] startKey : startKeys) {
+ byte[] rowKey = ByteUtil.getLargestPossibleRowKeyInRange(startKey,
HConstants.EMPTY_END_ROW);
+ assertNotNull(Bytes.toStringBinary(startKey), rowKey);
+ assertTrue(Bytes.toStringBinary(rowKey), Bytes.compareTo(startKey,
rowKey) < 0);
+ }
+ }
Review Comment:
This is out of scope.
##########
phoenix-core-client/src/main/java/org/apache/phoenix/util/ByteUtil.java:
##########
@@ -470,9 +470,11 @@ public static byte[] previousKey(byte[] key) {
* [startKey, endKey). If startKey and endKey are empty, the empty key is
returned. This function
* is used to return valid rowkey for some ungrouped aggregation e.g. while
returning count value
* after scanning the rows. If any error or validation issues (e.g. startKey
> endKey) are
- * encountered, null value is returned.
+ * encountered, null value is returned. An empty endKey means that the range
has no upper bound.
+ * If startKey is not empty and endKey is empty, the returned rowkey is a
rowkey just after
+ * startKey.
* @param startKey start rowkey for the range.
- * @param endKey end rowkey for the range.
+ * @param endKey end rowkey for the range, or the empty key for no upper
bound.
* @return best attempt of largest rowkey in the range of [startKey, endKey).
Review Comment:
Meh
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]