Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
address comments
  • Loading branch information
ConeyLiu committed Oct 22, 2019
commit 437aadfcd972347a5b5a017271a5ad7f09a7cd4c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class RDDBarrierSuite extends SparkFunSuite with SharedSparkContext {
val rdd = sc.parallelize(1 to 12, 4)
assert(rdd.isBarrier() === false)

val rdd2 = rdd.barrier().mapPartitionsWithIndex((index, iter) => Iterator(index, iter.sum))
val rdd2 = rdd.barrier().mapPartitionsWithIndex((index, iter) => Iterator(index))
assert(rdd2.isBarrier())
assert(rdd2.collect().toList === List((0, 6), (1, 15), (2, 24), (3, 33)))
assert(rdd2.collect().toList === List(0, 1, 2, 3))
}

test("create an RDDBarrier in the middle of a chain of RDDs") {
Expand Down
4 changes: 2 additions & 2 deletions python/pyspark/tests/test_rddbarrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ def test_map_partitions_with_index(self):
self.assertFalse(rdd._is_barrier())

def f(index, iterator):
yield index + sum(iterator)
yield index
rdd1 = rdd.barrier().mapPartitionsWithIndex(f)
self.assertTrue(rdd1._is_barrier())
self.assertEqual(rdd1.collect(), [3, 13, 23, 33])
self.assertEqual(rdd1.collect(), [0, 1, 2, 3])


if __name__ == "__main__":
Expand Down