SparkContext 이해하기
SparkContext는 Spark 기능으로 들어가는 진입점이에요. 자동차의 열쇠와 같다고 생각하시면 돼요. 어떤 Spark 애플리케이션이든 실행되면 메인 함수를 가진 드라이버 프로그램이 시작되고, 여기에서 SparkContext가 초기화돼요. PySpark 셸에서는 SparkContext가 자동으로 생성되어(직접 만들 필요가 없어요) 변수 sc로 제공돼요.
이 간단한 연습에서는 앞으로의 강의에서 계속 사용하게 될 PySpark 셸의 SparkContext 속성을 확인해 볼 거예요.
이 연습은 강의의 일부입니다
PySpark로 배우는 빅데이터 기초
연습 안내
- PySpark 셸에서 SparkContext의 버전을 출력하세요.
- PySpark 셸에서 SparkContext의 Python 버전을 출력하세요.
- PySpark 셸에서 SparkContext의 마스터는 무엇인가요?
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Print the version of SparkContext
print("The version of Spark Context in the PySpark shell is", sc.____)
# Print the Python version of SparkContext
print("The Python version of Spark Context in the PySpark shell is", ____.pythonVer)
# Print the master of SparkContext
print("The master of Spark Context in the PySpark shell is", ____.____)