Skip to content

Commit ecd6685

Browse files
committed
Added baseRelationToSchemaRDD back.
1 parent 4a38c9b commit ecd6685

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import org.apache.spark.sql.catalyst.rules.RuleExecutor
3737
import org.apache.spark.sql.execution._
3838
import org.apache.spark.sql.json._
3939
import org.apache.spark.sql.parquet.ParquetRelation
40-
import org.apache.spark.sql.sources.{DDLParser, DataSourceStrategy}
40+
import org.apache.spark.sql.sources.{LogicalRelation, BaseRelation, DDLParser, DataSourceStrategy}
4141
import org.apache.spark.sql.types._
4242

4343
/**
@@ -130,6 +130,13 @@ class SQLContext(@transient val sparkContext: SparkContext)
130130
new SchemaRDD(this, LogicalRDD(attributeSeq, rowRDD)(self))
131131
}
132132

133+
/**
134+
* Convert a [[BaseRelation]] created for external data sources into a [[SchemaRDD]].
135+
*/
136+
def baseRelationToSchemaRDD(baseRelation: BaseRelation): SchemaRDD = {
137+
new SchemaRDD(this, LogicalRelation(baseRelation))
138+
}
139+
133140
/**
134141
* :: DeveloperApi ::
135142
* Creates a [[SchemaRDD]] from an [[RDD]] containing [[Row]]s by applying a schema to this RDD.

0 commit comments

Comments
 (0)