File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
sql/core/src/main/scala/org/apache/spark/sql/sources Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ import org.apache.hadoop.fs.Path
21
21
22
22
import org .apache .spark .Logging
23
23
import org .apache .spark .deploy .SparkHadoopUtil
24
- import org .apache .spark .rdd .RDD
24
+ import org .apache .spark .rdd .{ UnionRDD , RDD }
25
25
import org .apache .spark .sql .Row
26
26
import org .apache .spark .sql .catalyst .expressions
27
27
import org .apache .spark .sql .catalyst .expressions ._
@@ -169,9 +169,12 @@ private[sql] object DataSourceStrategy extends Strategy with Logging {
169
169
scan.execute()
170
170
}
171
171
172
- val unionedRows = perPartitionRows.reduceOption(_ ++ _).getOrElse {
173
- relation.sqlContext.emptyResult
174
- }
172
+ val unionedRows =
173
+ if (perPartitionRows.length == 0 ) {
174
+ relation.sqlContext.emptyResult
175
+ } else {
176
+ new UnionRDD (relation.sqlContext.sparkContext, perPartitionRows)
177
+ }
175
178
176
179
createPhysicalRDD(logicalRelation.relation, output, unionedRows)
177
180
}
You can’t perform that action at this time.
0 commit comments