map reduce를 사용하여 왼쪽 조인 기능을 구현 중입니다. 왼쪽에는 약 6 억 개의 레코드가 있고 오른쪽에는 약 2 천 3 백만 개의 레코드가 있습니다. mapper에서 왼쪽 조인 조건에 사용 된 열을 사용하고 키퍼 출력을 감속기로 전달하는 키를 만들고 있습니다. 두 테이블의 값 수가 많은 매퍼 키가 거의 없기 때문에 성능 문제가 발생합니다 (예 : 각각 456789 및 78960). 다른 감속기가 작업을 마쳤지 만이 감속기는 더 오랜 시간 동안 계속 작동합니다. 성능을 높이기 위해 다중 감속기가 병렬로 매퍼의 동일한 키 - 값 출력에서 작동 할 수있는 방법이 있습니까?매퍼에서 단일 출력으로 여러 개의 축소판을 실행하십시오.
이것은 내가 최적화하고 싶은 하이브 쿼리입니다.
select distinct
a.sequence,
a.fr_nbr,
b.to_nbr,
a.fr_radius,
a.fr_zip,
a.latitude as fr_latitude,
a.longitude as fr_longitude,
a.to_zip,
b.latitude as to_latitude,
b.longitude as to_longitude,
((2 * asin(sqrt(cos(radians(a.latitude)) * cos(radians(b.latitude)) * pow(sin(radians((a.longitude - b.longitude)/2)), 2) + pow(sin(radians((a.latitude - b.latitude)/2)), 2)))) * 6371 * 0.621371) as distance,
a.load_year,
a.load_month
from common.sb_p1 a LEFT JOIN common.sb__temp0u b
on a.to_zip=b.zip
and a.load_year=b.load_year
and a.load_month=b.load_month
where b.correction = 0
and a.fr_nbr <> b.to_nbr
and ((2 * asin(sqrt(cos(radians(a.latitude)) * cos(radians(b.latitude)) * pow(sin(radians((a.longitude - b.longitude)/2)), 2) + pow(sin(radians((a.latitude - b.latitude)/2)), 2)))) * 6371 * 0.621371 <= a.fr_radius)
다른 해결책도 있습니다.
에 배포되지 않습니다? 지도 측 (복제) 또는 축소 측 (재분할)? – Nicomak
키를 알고 있다면 더 나은 성능을 위해 사용자 정의 파티션을 작성할 수 있습니다. Exp : If key.value <78960 .... else .... https://www.tutorialspoint.com/map_reduce/map_reduce_partitioner.htm – pckmn
@Nicomak 축소 결합을 사용하고 있습니다. –