richardstartin commented on a change in pull request #7487:
URL: https://github.com/apache/pinot/pull/7487#discussion_r719375301
##########
File path: pinot-spi/src/main/java/org/apache/pinot/spi/utils/ByteArray.java
##########
@@ -91,19 +115,55 @@ public int compareTo(@Nonnull ByteArray that) {
* <li> +ve integer if first value is larger than the second. </li>
* </ul>
*
- * @param bytes1 First byte[] to compare.
- * @param bytes2 Second byte[] to compare.
+ * @param left First byte[] to compare.
+ * @param right Second byte[] to compare.
* @return Result of comparison as stated above.
*/
- public static int compare(byte[] bytes1, byte[] bytes2) {
- int len1 = bytes1.length;
- int len2 = bytes2.length;
+ public static int compare(byte[] left, byte[] right) {
+ return compare(left, 0, left.length, right, 0, right.length);
+ }
+
+ /**
+ * Compares two byte[] values. The comparison performed is on unsigned value
for each byte.
+ * Returns:
+ * <ul>
+ * <li> 0 if both values are identical. </li>
+ * <li> -ve integer if first value is smaller than the second. </li>
+ * <li> +ve integer if first value is larger than the second. </li>
+ * </ul>
+ *
+ * @param left First byte[] to compare.
+ * @param leftFromIndex inclusive index of first byte to compare in left
+ * @param leftToIndex exclusive index of last byte to compare in left
+ * @param right Second byte[] to compare.
+ * @param rightFromIndex inclusive index of first byte to compare in right
+ * @param rightToIndex exclusive index of last byte to compare in right
+ * @return Result of comparison as stated above.
+ */
+ public static int compare(byte[] left, int leftFromIndex, int leftToIndex,
+ byte[] right, int rightFromIndex, int rightToIndex) {
+ if (COMPARE_UNSIGNED != null) {
Review comment:
To do this with a Multi-Release jar you need two versions of the class
`foo.bar.MultiVersionClass`, one compiled at `--release 8`, using only JDK8
APIs, and the other using `Arrays.compareUnsigned` at `--release 9`, and they
need to be packaged in different directories. The JDK8 class file should be at
`/foo/bar/MultiVersionClass.class` and the JDK9 one at
`META-INF/versions/9/foo/bar/MultiVersionClass.class`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]