import akka.japi.Function2;
import org.apache.spark.HashPartitioner;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.FlatMapFunction;
import org.apache.spark.api.java.function.Function;
import org.apache.spark.api.java.function.PairFlatMapFunction;
import org.apache.spark.storage.StorageLevel;
import scala.Tuple2;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* map flatMap flatMapToPair mapPartitions 的区别和用途
*
* 例如数据是:name:gaoyue age:28
*
* 方法一:map,我们可以看到数据的每一行在map之后产生了一个数组,那么rdd存储的是一个数组的集合
* rdd存储的状态是Array[Array[String]] = Array(Array(name, gaoyue), Array(age, 28))
*Array[Strin
spark map flatMap flatMapToPair mapPartitions 的区别和用途
最新推荐文章于 2023-05-12 23:17:30 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)