I'm processing a file for which I run a repartition(48, key) prior to saving as a delta. At initial run, it generates around 25 partitions within the delta (no issue as it's possible the key resulted in data falling into 25 partitions - I assume it doesn't necessarily create a partition for a node that didn't have data?).
However, on the second run, which is done via a MERGE, 60+ partition files were generated (it's a SCD process with 1700 keys pre-existing and only 300 new keys)
My understanding is that repartition uses a hash algorithm to determine which of the partitions a key falls into, so if that is the case, how did it create more partition files than defined partitions?
Code sample:
df = spark.read...
key = ["COL_A"]
partitions = 48
df.repartition(partitions, *[col(c) for c in key])