package org.apache.spark.sql.sources
trait RelationProvider {
def createRelation(
sqlContext: SQLContext,
parameters: Map[String, String]): BaseRelation
}
RelationProvider — Data Sources With Schema Inference
RelationProvider
is a contract for data source providers that support schema inference (and also can be accessed using SQL’s USING clause, i.e. in CREATE TEMPORARY VIEW
and DROP DATABASE
DDL operators).
Note
|
Schema inference is also called schema discovery. |
RelationProvider
is used exclusively when:
-
DataSource
creates a BaseRelation (with no user-defined schema or the user-defined schema matchesRelationProvider
's)
Note
|
BaseRelation models a collection of tuples from an external data source with a schema. |
Name | Description |
---|---|
Tip
|
Use SchemaRelationProvider for relation providers that require a user-defined schema. |