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 2021/05/17 18:41:21 UTC

[GitHub] [incubator-pinot] mayankshriv commented on a change in pull request #6929: Add support for Long in Modulo partition function.

mayankshriv commented on a change in pull request #6929:
URL: https://github.com/apache/incubator-pinot/pull/6929#discussion_r633764172



##########
File path: .gitignore
##########
@@ -26,6 +26,7 @@ docs/_build
 **/.env
 **/.factorypath
 kubernetes/examples/helm/charts/
+examples/

Review comment:
       Hmm, I see. Reverted.

##########
File path: pinot-segment-local/src/main/java/org/apache/pinot/segment/local/partition/ModuloPartitionFunction.java
##########
@@ -53,6 +53,9 @@ public ModuloPartitionFunction(int numPartitions) {
   public int getPartition(Object value) {
     if (value instanceof Integer) {
       return ((Integer) value) % _numPartitions;
+    } else if (value instanceof Long) {
+      // Since _numPartitions is int, the modulo should also be int.
+      return (int) (((Long) value) % _numPartitions);
     } else if (value instanceof String) {
       return ((Integer.parseInt((String) value)) % _numPartitions);

Review comment:
       Yeah, done. Also added tests.




-- 
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:
users@infra.apache.org



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