官术网_书友最值得收藏!

.repartition(...) transformation

The repartition(n) transformation repartitions the RDD into n partitions by randomly reshuffling and uniformly distributing data across the network. As noted in the preceding recipes, this can improve performance by running more parallel threads concurrently. Here's a code snippet that does precisely that:

# The flights RDD originally generated has 2 partitions 
flights.getNumPartitions()

# Output
2

# Let's re-partition this to 8 so we can have 8
# partitions
flights2 = flights.repartition(8)

# Checking the number of partitions for the flights2 RDD
flights2.getNumPartitions()

# Output
8
主站蜘蛛池模板: 资溪县| 读书| 介休市| 新乡市| 鄂伦春自治旗| 本溪市| 富宁县| 德州市| 元氏县| 屏南县| 花莲市| 台前县| 伽师县| 栖霞市| 彭州市| 富锦市| 南平市| 湖北省| 永登县| 青海省| 彩票| 馆陶县| 无为县| 娄底市| 瓮安县| 青河县| 肥乡县| 罗城| 松原市| 孙吴县| 鄂尔多斯市| 布拖县| 沧州市| 海兴县| 吴忠市| 新巴尔虎右旗| 苍山县| 阳曲县| 景洪市| 项城市| 宜章县|