将Spark中CompactBuf转换为String

 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(",")}"""}
posted @ 2016-08-22 11:39  蚂蚁都督  阅读(475)  评论(0编辑  收藏  举报