Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Associate Developer for Apache Spark All Questions

View all questions & answers for the Certified Associate Developer for Apache Spark exam

Exam Certified Associate Developer for Apache Spark topic 1 question 16 discussion

Which of the following operations can be used to create a new DataFrame that has 12 partitions from an original DataFrame df that has 8 partitions?

  • A. df.repartition(12)
  • B. df.cache()
  • C. df.partitionBy(1.5)
  • D. df.coalesce(12)
  • E. df.partitionBy(12)
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
4be8126
Highly Voted 1 year, 6 months ago
Selected Answer: A
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.
upvoted 6 times
...
NuclearGandhi
Most Recent 1 year ago
Selected Answer: A
nice explanation @4be8126
upvoted 1 times
...
TmData
1 year, 5 months ago
Selected Answer: A
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.
upvoted 1 times
...
SonicBoom10C9
1 year, 6 months ago
Selected Answer: A
Comprehensive explanation by 4be8126, only using this comment to vote A.
upvoted 1 times
...
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.

SaveCancel
Loading ...