private long computeNumberOfPartitions(int numTasks,long totalPointsInRange,int minDatapointsPerTask){
  final long maxTasksByDatapointRestriction=totalPointsInRange / minDatapointsPerTask;
  final long desiredNumTasks=Math.max(numTasks,1);
  long nrSubRanges=Math.min(maxTasksByDatapointRestriction,desiredNumTasks);
  return Math.max(1,nrSubRanges);
}

private long computeNumberOfPartitions ( int numTasks , long totalPointsInRange , int minDatapointsPerTask ) { final long maxTasksByDatapointRestriction = totalPointsInRange / minDatapointsPerTask ; final long desiredNumTasks = Math . max ( numTasks , 1 ) ; long nrSubRanges = Math . min ( maxTasksByDatapointRestriction , desiredNumTasks ) ; return Math . max ( 1 , nrSubRanges ) ; }
the number of partitions is calculated based on two parameters . first , there is a minumum number of datapoints per task , which is considered a hard limit . this means , we generate * at most * ( totalpointsinrange / mindatapointspertask ) tasks . the second parameter is the numtasks parameter , which tells us the " desired " number of tasks . the number of subranges is then defined as follows : - if the desired number of tasks is larger than the hard limit , we choose the hard limit - otherwise , we choose the desired number of tasks effectively , this means choosing the smaller of the two values ( min ) , while making sure that the value returned is > = 1 .
