Learn R Programming

SparkR (version 3.1.2)

sql: SQL Query

Description

Executes a SQL query using Spark, returning the result as a SparkDataFrame.

Usage

sql(sqlQuery)

Arguments

sqlQuery

A character vector containing the SQL query

Value

SparkDataFrame

Examples

Run this code
# NOT RUN {
sparkR.session()
path <- "path/to/file.json"
df <- read.json(path)
createOrReplaceTempView(df, "table")
new_df <- sql("SELECT * FROM table")
# }

Run the code above in your browser using DataLab