Beispiel #1
0
 def test_dtypes(self):
     rdd = self.generate()
     blocked = BlockRDD(rdd, dtype=list)
     assert_is_instance(blocked.first(), list)
     blocked = BlockRDD(rdd, dtype=tuple)
     assert_is_instance(blocked.first(), tuple)
     blocked = BlockRDD(rdd, dtype=set)
     assert_is_instance(blocked.first(), set)
     blocked = BlockRDD(rdd, dtype=np.array)
     assert_is_instance(blocked.first(), np.ndarray)
Beispiel #2
0
 def test_dtypes(self):
     rdd = self.generate()
     blocked = BlockRDD(rdd, dtype=list)
     assert_is_instance(blocked.first(), list)
     blocked = BlockRDD(rdd, dtype=tuple)
     assert_is_instance(blocked.first(), tuple)
     blocked = BlockRDD(rdd, dtype=set)
     assert_is_instance(blocked.first(), set)
     blocked = BlockRDD(rdd, dtype=np.array)
     assert_is_instance(blocked.first(), np.ndarray)
Beispiel #3
0
    def test_creation(self):
        rdd = self.generate()

        blocked = BlockRDD(rdd)
        assert_is_instance(blocked, BlockRDD)
        assert_equal(blocked.first(), range(10))
        assert_equal(blocked.collect(), np.arange(100).reshape(10, 10).tolist())

        blocked = BlockRDD(rdd, bsize=4)
        assert_is_instance(blocked, BlockRDD)
        assert_equal(blocked.first(), range(4))
        assert_equal([len(x) for x in blocked.collect()], [4, 4, 2] * 10)
Beispiel #4
0
    def test_creation(self):
        rdd = self.generate()

        blocked = BlockRDD(rdd)
        assert_is_instance(blocked, BlockRDD)
        expected = tuple(range(10))
        assert_equal(blocked.first(), expected)
        expected = [tuple(v) for v in np.arange(100).reshape(10, 10)]
        assert_equal(blocked.collect(), expected)

        blocked = BlockRDD(rdd, bsize=4)
        assert_is_instance(blocked, BlockRDD)
        expected = tuple(range(4))
        assert_equal(blocked.first(), expected)
        expected = [4, 4, 2] * 10
        assert_equal([len(x) for x in blocked.collect()], expected)
    def test_creation(self):
        rdd = self.generate()

        blocked = BlockRDD(rdd)
        assert_is_instance(blocked, BlockRDD)
        expected = tuple(range(10))
        assert_equal(blocked.first(), expected)
        expected = [tuple(v) for v in np.arange(100).reshape(10, 10)]
        assert_equal(blocked.collect(), expected)

        blocked = BlockRDD(rdd, bsize=4)
        assert_is_instance(blocked, BlockRDD)
        expected = tuple(range(4))
        assert_equal(blocked.first(), expected)
        expected = [4, 4, 2] * 10
        assert_equal([len(x) for x in blocked.collect()], expected)