Skip to content

Commit 0ad97b2

Browse files
committed
reviewer comments.
1 parent 2948aae commit 0ad97b2

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

core/src/main/scala/org/apache/spark/api/java/JavaPairRDD.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ class JavaPairRDD[K, V](val rdd: RDD[(K, V)])
158158

159159
/**
160160
* ::Experimental::
161-
*
162161
* Return a subset of this RDD sampled by key (via stratified sampling) containing exactly
163162
* math.ceil(numItems * samplingRate) for each stratum (group of pairs with the same key).
164163
*
@@ -176,7 +175,6 @@ class JavaPairRDD[K, V](val rdd: RDD[(K, V)])
176175

177176
/**
178177
* ::Experimental::
179-
*
180178
* Return a subset of this RDD sampled by key (via stratified sampling) containing exactly
181179
* math.ceil(numItems * samplingRate) for each stratum (group of pairs with the same key).
182180
*

core/src/main/scala/org/apache/spark/rdd/PairRDDFunctions.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ class PairRDDFunctions[K, V](self: RDD[(K, V)])
222222

223223
/**
224224
* ::Experimental::
225-
*
226225
* Return a subset of this RDD sampled by key (via stratified sampling) containing exactly
227226
* math.ceil(numItems * samplingRate) for each stratum (group of pairs with the same key).
228227
*

core/src/test/java/org/apache/spark/JavaAPISuite.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,12 +1246,12 @@ public Tuple2<Integer, Integer> call(Integer i) {
12461246
public void sampleByKeyExact() {
12471247
JavaRDD<Integer> rdd1 = sc.parallelize(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8), 3);
12481248
JavaPairRDD<Integer, Integer> rdd2 = rdd1.mapToPair(
1249-
new PairFunction<Integer, Integer, Integer>() {
1250-
@Override
1251-
public Tuple2<Integer, Integer> call(Integer i) {
1252-
return new Tuple2<Integer, Integer>(i % 2, 1);
1253-
}
1254-
});
1249+
new PairFunction<Integer, Integer, Integer>() {
1250+
@Override
1251+
public Tuple2<Integer, Integer> call(Integer i) {
1252+
return new Tuple2<Integer, Integer>(i % 2, 1);
1253+
}
1254+
});
12551255
Map<Integer, Object> fractions = Maps.newHashMap();
12561256
fractions.put(0, 0.5);
12571257
fractions.put(1, 1.0);

core/src/test/scala/org/apache/spark/rdd/PairRDDFunctionsSuite.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,8 @@ class PairRDDFunctionsSuite extends FunSuite with SharedSparkContext {
592592
val sampleCounts = sample.countByKey()
593593
val takeSample = sample.collect()
594594
sampleCounts.foreach { case (k, v) =>
595-
assert(checkSize(exact, true, expectedSampleSize(k), v, samplingRate)) }
595+
assert(checkSize(exact, true, expectedSampleSize(k), v, samplingRate))
596+
}
596597
val groupedByKey = takeSample.groupBy(_._1)
597598
for ((key, v) <- groupedByKey) {
598599
if (expectedSampleSize(key) >= 100 && samplingRate >= 0.1) {
@@ -606,7 +607,7 @@ class PairRDDFunctionsSuite extends FunSuite with SharedSparkContext {
606607
}
607608
}
608609
}
609-
takeSample.foreach { x => assert(1 <= x._2 && x._2 <= n, s"elements not in [1, $n]") }
610+
takeSample.foreach(x => assert(1 <= x._2 && x._2 <= n, s"elements not in [1, $n]"))
610611
}
611612
}
612613

0 commit comments

Comments
 (0)