sql: SQL Query

Description Usage Arguments Value Note Examples

View source: R/SQLContext.R

Description

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

Usage

1
sql(sqlQuery)

Arguments

sqlQuery

A character vector containing the SQL query

Value

SparkDataFrame

Note

sql since 1.4.0

Examples

1
2
3
4
5
6
7
8
## Not run: 
sparkR.session()
path <- "path/to/file.json"
df <- read.json(path)
createOrReplaceTempView(df, "table")
new_df <- sql("SELECT * FROM table")

## End(Not run)

SparkR documentation built on June 3, 2021, 5:05 p.m.