将Spark中CompactBuf转换为String

时间:2023-12-19 11:58:50
 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(",")}"""}