Back to Spark

REFRESH

docs/sql-ref-syntax-aux-cache-refresh.md

4.1.11.0 KB
Original Source

Description

REFRESH is used to invalidate and refresh all the cached data (and the associated metadata) for all Datasets that contains the given data source path. Path matching is by prefix, i.e. "/" would invalidate everything that is cached.

Note: Cached data is shared across all Spark sessions on the cluster, so refreshing it affects all sessions.

Syntax

sql
REFRESH resource_path

Parameters

  • resource_path

    The path of the resource that is to be refreshed.

Examples

sql
-- The Path is resolved using the datasource's File Index.
CREATE TABLE test(ID INT) using parquet;
INSERT INTO test SELECT 1000;
CACHE TABLE test;
INSERT INTO test SELECT 100;
REFRESH "hdfs://path/to/table";