ComenzarEmpieza gratis

Almacenar y quitar tablas del caché

En la lección vimos que se pueden almacenar tablas en caché. Mientras que un dataframe se almacena en caché con una operación cache o persist, una tabla se almacena con una operación cacheTable.

Hay disponible una tabla llamada table1.

Este ejercicio forma parte del curso

Introducción a Spark SQL en Python

Ver curso

Instrucciones del ejercicio

  • Lista las tablas con el método listTables().
  • Almacena en caché table1 y confirma que está en caché.
  • Quita del caché table1 y confirma que ya no lo está.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# 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'))
Editar y ejecutar código