Spark 브로드캐스트 변수 사용

1134 단어 Spark
//landscape_zb :mutable.HashMap[String, ArrayBuffer[Any]]
// landscape  (new_key,(ls_id, lat, lon)), ArrayBuffer lat, lon 
var bc_landscape_zb = sc.broadcast(landscape_zb)

val bc_landscape_new =
  no_home_new_key.mapPartitions({
    iter =>
      var bc_landscape = bc_landscape_zb.value
      for {
        it //it is (new_key,(phone_no,travel_time,lat,lon))
        if (bc_landscape.contains(it._1))
      } yield (it._2._1, it._2._2, it._2._3, bc_landscape.get(it._1).get)
    // (phone_no, travel_time, ls_id, (Double, Double), (Double, Double))
  })

좋은 웹페이지 즐겨찾기