File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
core/src/test/scala/org/apache/spark/rdd Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -457,10 +457,7 @@ class RDDSuite extends FunSuite with SharedSparkContext {
457457
458458 test(" takeSample" ) {
459459 val data = sc.parallelize(1 to 100 , 2 )
460- val emptySet = data.mapPartitions { iter => Iterator .empty }
461460
462- val sample = emptySet.takeSample(false , 20 , 1 )
463- assert(sample.length === 0 )
464461 for (seed <- 1 to 5 ) {
465462 val sample = data.takeSample(withReplacement= false , 20 , seed)
466463 assert(sample.size === 20 ) // Got exactly 20 elements
@@ -492,6 +489,12 @@ class RDDSuite extends FunSuite with SharedSparkContext {
492489 }
493490 }
494491
492+ test(" takeSample from an empty rdd" ) {
493+ val emptySet = sc.parallelize(Seq .empty[Int ], 2 )
494+ val sample = emptySet.takeSample(false , 20 , 1 )
495+ assert(sample.length === 0 )
496+ }
497+
495498 test(" randomSplit" ) {
496499 val n = 600
497500 val data = sc.parallelize(1 to n, 2 )
You can’t perform that action at this time.
0 commit comments