createTable {SparkR}R Documentation

Creates a table based on the dataset in a data source

Description

Creates a table based on the dataset in a data source. Returns a SparkDataFrame associated with the table.

Usage

createTable(tableName, path = NULL, source = NULL, schema = NULL,
  ...)

Arguments

tableName

the qualified or unqualified name that designates a table. If no database identifier is provided, it refers to a table in the current database.

path

(optional) the path of files to load.

source

(optional) the name of the data source.

schema

(optional) the schema of the data required for some data sources.

...

additional named parameters as options for the data source.

Details

The data source is specified by the source and a set of options(...). If source is not specified, the default data source configured by "spark.sql.sources.default" will be used. When a path is specified, an external table is created from the data at the given path. Otherwise a managed table is created.

Value

A SparkDataFrame.

Note

createTable since 2.2.0

Examples

## Not run: 
##D sparkR.session()
##D df <- createTable("myjson", path="path/to/json", source="json", schema)
##D 
##D createTable("people", source = "json", schema = schema)
##D insertInto(df, "people")
## End(Not run)

[Package SparkR version 2.4.0 Index]