File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
sql/core/src/main/scala/org/apache/spark/sql/json Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,8 @@ private[sql] class JSONRelation(
111111 @ transient val sqlContext : SQLContext )
112112 extends BaseRelation
113113 with TableScan
114- with InsertableRelation {
114+ with InsertableRelation
115+ with CatalystScan {
115116
116117 def this (
117118 path : String ,
@@ -158,6 +159,19 @@ private[sql] class JSONRelation(
158159 }
159160 }
160161
162+ override def buildScan (requiredColumns : Seq [Attribute ], filters : Seq [Expression ]): RDD [Row ] = {
163+ if (useJsonRDD2) {
164+ JsonRDD2 .jsonStringToRow(
165+ baseRDD,
166+ StructType .fromAttributes(requiredColumns),
167+ sqlContext.conf.columnNameOfCorruptRecord)
168+ } else {
169+ JsonRDD .jsonStringToRow(
170+ baseRDD,
171+ StructType .fromAttributes(requiredColumns),
172+ sqlContext.conf.columnNameOfCorruptRecord)
173+ }
174+ }
161175
162176 override def insert (data : DataFrame , overwrite : Boolean ): Unit = {
163177 val filesystemPath = path match {
You can’t perform that action at this time.
0 commit comments