sql {SparkR}R Documentation

SQL Query

Description

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

Usage

sql(sqlContext, sqlQuery)

Arguments

sqlContext

SQLContext to use

sqlQuery

A character vector containing the SQL query

Value

DataFrame

Examples

## Not run: 
##D sc <- sparkR.init()
##D sqlContext <- sparkRSQL.init(sc)
##D path <- "path/to/file.json"
##D df <- jsonFile(sqlContext, path)
##D registerTempTable(df, "table")
##D new_df <- sql(sqlContext, "SELECT * FROM table")
## End(Not run)

[Package SparkR version 1.4.0 Index]