question: 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 ) ; }
target:  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.