import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import java.util.Arrays;
import java.util.List;
/**
* frist 算子:
*
* 取RDD的第一个元素
*
*/
public class FristOperator {
public static void main(String[] args){
SparkConf conf = new SparkConf().setMaster("local").setAppName("FristOperator");
JavaSparkContext sc = new JavaSparkContext(conf);
List<String> names = Arrays.asList("w1","w2","w3","w4","w5","W6","W7");
JavaRDD<String> nameRDD = sc.parallelize(names,2);
System.err.println(nameRDD.first());
}
}
微信扫描下图二维码加入博主知识星球,获取更多大数据、人工智能、算法等免费学习资料哦!