tkhurana commented on code in PR #1736:
URL: https://github.com/apache/phoenix/pull/1736#discussion_r1480462587


##########
phoenix-core-client/src/main/java/org/apache/phoenix/util/ByteUtil.java:
##########
@@ -469,6 +474,116 @@ public static byte[] previousKey(byte[] key) {
         return previousKey;
     }
 
+    /**
+     * Best attempt to generate largest rowkey smaller than endKey i.e. 
largest rowkey in the
+     * range of [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.
+     *
+     * @param startKey start rowkey for the range.
+     * @param endKey end rowkey for the range.
+     * @return best attempt of largest rowkey in the range of [startKey, 
endKey).
+     */
+    public static byte[] getLargestPossibleRowKeyInRange(byte[] startKey, 
byte[] endKey) {

Review Comment:
   Can we add some unit tests for this ?



-- 
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]

Reply via email to