[SPARK-2082] stratified sampling in PairRDDFunctions that guarantees exact sample size

Implemented stratified sampling that guarantees exact sample size using ScaRSR with two passes over the RDD for sampling without replacement and three passes for sampling with replacement.
This can be written more functional (and readable) like this:
```scala
    val samplingFunc = if (withReplacement) {
      val counts = if (exact) Some(this.countByKey()) else None
        StratifiedSampler.getPoissonSamplingFunction(self, fractions, exact, counts, seed)
    } else {
        StratifiedSampler.getBernoulliSamplingFunction(self, fractions, exact, seed)
    }
    self.mapPartitionsWithIndex(samplingFunc, preservesPartitioning = true)
```