Article Directory
1. Detailed introduction to the fold operator in Spark
In the previous section, we talked about using aggregate
the function to implement aggregation operations within and between partitions. However, for aggregate
different aggregation logic within and between partitions, sometimes our intra-partition and inter-partition aggregation operations are consistent, so we can Simplification is performed using fold
the operator.
1. Function introduction
In Spark, fold
it is a transformation operator (Transformation Operator) that performs aggregation operations on RDD. It can combine the elements in the RDD with an initial value one by one, and use the specified aggregation function to get a final aggregation result.
grammar: