
Explanation:
To create a DataFrame with 12 partitions from an existing DataFrame with 8 partitions, the key is to use operations that can increase the partition count.
repartition triggers a full shuffle and can increase or decrease the number of partitions to the specified value (12 here).coalesce can only reduce the number of partitions. If the target is larger than the current partition count (8 → 12), it leaves the DataFrame unchanged.cache() does not alter partitions, partitionBy is not a DataFrame method (used in writing data), and partition counts must be integers.Ultimate access to all questions.
No comments yet.
Which of the following operations can be used to create a new DataFrame with 12 partitions from an original DataFrame df that currently has 8 partitions?
A
df.repartition(12)
B
df.cache()
C
df.partitionBy(1.5)
D
df.coalesce(12)
E
df.partitionBy(12)