I have a HUGE table, where my spark job keeps crashing. I want to repartition it. I have two variables (id, time) where I need to ensure that all rows with a given id will be parittioned to the same worker. But I have hundreds of millions of unique IDs. I want pyspark to evenly spread the data, but respecting that for a given ID all rows should be on one worker. Can I simply do :
df.repartition("id")
The documentation, seems to suggest so. But I am wondering whether spark will now partition the job into hundreds of millions of subsets and only send one subset (i.e. data of one id) to the each worker at a time. This would be very inefficient of course.
I am using Spark 2.4.0-cdh6.2.1