val rdd = sc.textFile("hdfs://hbase11:9000/sparkTsData/ipsoftware/wincc").map{ line => {val regex(ip,software) = line; (ip,software)}}
val rdd2 = sc.textFile("hdfs://hbase11:9000/sparkTsData/ipsoftware/websense").map{ line => {val regex(ip,software) = line; (ip,software)}}
val rdd_un = rdd union rdd2
rdd_un.count
val grouped_rdd = rdd_un.groupByKey
grouped_rdd.take(10)
rdd_un.take(10)
val grouped_rdd2 = grouped_rdd.map{ case (k,xs) => s"""($k,${xs.mkString(",")}"""}
转载于:https://www.cnblogs.com/mayidudu/p/5794992.html