//1.
val saprk: SparkSession = SparkSession.builder().master(“local”).appName(“test”).getOrCreate()
//读取数据进行广播
val filed=saprk.sparkContext.textFile(“data\app_dict.txt”)
.filter(_.split("\t").length>=5)
.map(t=>{
val arr=t.split("\t")
(arr(4),arr(1))
}).collectAsMap()
//广播
val bc: Broadcast[collection.Map[String, String]] = saprk.sparkContext.broadcast(filed)
//在rdd里就可以用了!
02-07
209
07-13
4620