- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 10:57 AM - edited 05-21-2024 10:58 AM
Hello @subham0611 ,
The coalesce operation triggered from user code can be initiated from either an RDD or a Dataset, with each having distinct codepaths:
- RDD:
https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/rdd/RDD.scala - Dataset: https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/Dataset.sca...
Both the RDD and Dataset classes contain a coalesce function.
The coalescing logic is relatively straightforward:
The driver node determines the Spark plan for the coalesce operation. When using the Dataset API, this operation results in a narrow dependency. For instance, if you reduce the number of partitions from 1000 to 100, there will not be a shuffle. Instead, each of the 100 new partitions will claim 10 of the current partitions.
Raphael Balogo
Sr. Technical Solutions Engineer
Databricks