Skip to contents

Creates a new temporary view using a SparkDataFrame in the Spark Session. If a temporary view with the same name already exists, replaces it.

Usage

createOrReplaceTempView(x, viewName)

# S4 method for SparkDataFrame,character
createOrReplaceTempView(x, viewName)

Arguments

x

A SparkDataFrame

viewName

A character vector containing the name of the table

Note

createOrReplaceTempView since 2.0.0

Examples

if (FALSE) {
sparkR.session()
path <- "path/to/file.json"
df <- read.json(path)
createOrReplaceTempView(df, "json_df")
new_df <- sql("SELECT * FROM json_df")
}