dropTempTableΒΆ

dropTempTable drops the the specified temporary table. If the table has been cached/persisted before, it will also be unpersisted.

Note:

Temporary Tables do not persist across clusters and cluster restarts.

Syntax:

  • dropTempTable(“tableName”)

Parameters:

  • tableName: String, name of table to drop

Output:

  • NULL
require(SparkR)

# Create SparkDataFrame from local R data frame
df <- createDataFrame(mtcars)
head(df)
# Register df as Temporary Table, with table name: tempTable
registerTempTable(df, "tempTable")

# View created tables
# column isTemporary indicates if table is temporary or not
head(sql("SHOW tables"))
# Drop tempTable
dropTempTable("tempTable")

# View created tables, "tempTable" is no longer in list
head(sql("SHOW tables"))