You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/02/18 00:16:28 UTC

[GitHub] [pinot] richardstartin commented on a change in pull request #8221: Ensure partition function never return negative partition

richardstartin commented on a change in pull request #8221:
URL: https://github.com/apache/pinot/pull/8221#discussion_r809575579



##########
File path: pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/partition/HashCodePartitionFunction.java
##########
@@ -57,4 +56,8 @@ public int getNumPartitions() {
   public String toString() {
     return NAME;
   }
+
+  private int abs(int n) {
+    return (n == Integer.MIN_VALUE) ? 0 : Math.abs(n);

Review comment:
       this is equivalent to `Math.abs(n) & Integer.MAX_VALUE` but the callers could just move the modulo inside the `Math.abs` to avoid dealing with `Integer.MIN_VALUE`




-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org