BaşlayınÜcretsiz Başlayın

Caching and uncaching tables

In the lesson we learned that tables can be cached. Whereas a dataframe is cached using a cache or persist operation, a table is cached using a cacheTable operation.

A table called table1 is available.

Bu egzersiz

Introduction to Spark SQL in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • List the tables with the listTables() method.
  • Cache table1 and confirm that it is cached.
  • Uncache table1 and confirm that it is uncached.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# 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'))
Kodu Düzenle ve Çalıştır