scala> val rdd = sc.textFile("/testfile/chapter5-data1.txt")
// 切分每一行,取到第一个name元素组成新的RDD
scala> val nameRDD = rdd.map(row => row.split(",")(0))
// 去重
scala> val result = nameRDD.distinct()
// 统计总数
scala> result.count
res10: Long = 265
scala> val classRDD = rdd.map(row => row.split(",")(1))
scala> val result = classRDD.distinct()
scala> result.count
res11: Long = 8
(3) Tom 同学的总成绩平均分是多少;