테이블 캐싱과 캐시 해제
이 레슨에서 테이블도 캐시할 수 있다는 것을 배웠습니다. 데이터프레임은 cache 또는 persist 연산으로 캐시하는 반면, 테이블은 cacheTable 연산으로 캐시합니다.
table1이라는 테이블이 제공됩니다.
이 연습은 강의의 일부입니다
Python에서 Spark SQL 입문
연습 안내
listTables()메서드로 테이블 목록을 확인하세요.table1을 캐시하고, 캐시되었는지 확인하세요.table1의 캐시를 해제하고, 해제되었는지 확인하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# List the tables
print("Tables:\n", spark.____.____())
# Cache table1 and Confirm that it is cached
spark.catalog.____('table1')
print("table1 is cached: ", spark.catalog.____('table1'))
# Uncache table1 and confirm that it is uncached
spark.catalog.____('table1')
print("table1 is cached: ", spark.catalog.____('table1'))