The .repartition(...) transformation

The .repartition(...) transformation shuffles the data around the cluster and combines it into a specified number of partitions. You can also specify the column or columns you want to use to perform the partitioning on. There is no direct equivalent in the SQL world.

Look at the following code:

sample_data_schema_rep = (
sample_data_schema
.repartition(2, 'Year')
)

sample_data_schema_rep.rdd.getNumPartitions()

It produces (as expected) this result:

2
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset