Skip to content

SchemaRelationProvider — Relation Providers With Mandatory User-Defined Schema

SchemaRelationProvider is the <> of <> that <>.

The requirement of specifying a user-defined schema is enforced when DataSource is requested for a BaseRelation for a given data source format. If not specified, DataSource throws a AnalysisException:

A schema needs to be specified when using [className].

[[contract]] [source, scala]


package org.apache.spark.sql.sources

trait SchemaRelationProvider { def createRelation( sqlContext: SQLContext, parameters: Map[String, String], schema: StructType): BaseRelation }


.SchemaRelationProvider Contract [cols="1,2",options="header",width="100%"] |=== | Method | Description

| createRelation | [[createRelation]] Creates a BaseRelation for the user-defined schema

Used exclusively when DataSource is requested for a BaseRelation for a given data source format |===

Implementations

Note

No known native Spark SQL implementations.

Tip

RelationProvider is used for data source providers with schema inference.

Tip

Use both SchemaRelationProvider and RelationProvider if a data source should support both schema inference and user-defined schemas.