Spark에서 count 함수와 collect 함수의 차이

2021-08-27

.

Data_Engineering_TIL(20210827)

[학습시 참고자료]

“[Spark] Collect 와 Count 의 차이” 블로그글

https://wooono.tistory.com/338?category=914839

[학습내용]

  • collect()

Executor에 할당된 RDD 를 모두 Driver Node 로 취합하는 Action 이기 때문에, out of memory 가 발생할 수 있음

데이터 세트가 Drvier Memory 에 들어가지 못하는 크기라면, 사용하지 않는 것을 권고함

  • count()

Executor 에 할당된 RDD 의 개수를 합산하고, 합산된 정수를 반환하는 Action 이기 때문에, 데이터 전송이 최소화됨