The answer is A. The repartition operation can be used to increase or decrease the number of partitions in a DataFrame. In this case, the number of partitions is being increased from 8 to 12, so we can use the repartition operation with a partition count of 12: df.repartition(12).
Option B, df.cache(), is used to cache a DataFrame in memory for faster access, but it does not change the number of partitions.
Option C, df.partitionBy(1.5), is not a valid operation for partitioning a DataFrame.
Option D, df.coalesce(12), can be used to reduce the number of partitions in a DataFrame, but it cannot be used to increase the number of partitions beyond the current number.
Option E, df.partitionBy(12), is used to partition a DataFrame by a specific column or set of columns, but it does not change the number of partitions.
The operation that can be used to create a new DataFrame with 12 partitions from an original DataFrame df that has 8 partitions is:
D. df.coalesce(12)
Explanation:
The coalesce() operation in Spark is used to decrease the number of partitions in a DataFrame, and it can be used to create a new DataFrame with a specific number of partitions. In this case, calling df.coalesce(12) on the original DataFrame df with 8 partitions will create a new DataFrame with 12 partitions.
Comprehensive explanation by 4be8126, only using this comment to vote A.
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
4be8126
Highly Voted 1 year, 6 months agoNuclearGandhi
Most Recent 1 year agoTmData
1 year, 5 months agoSonicBoom10C9
1 year, 6 months ago