MaxGekk commented on a change in pull request #27530: [SPARK-30780][SQL] Empty
LocalTableScan should use RDD without partitions
URL: https://github.com/apache/spark/pull/27530#discussion_r377545495
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/LocalTableScanExec.scala
##########
@@ -45,10 +45,14 @@ case class LocalTableScanExec(
}
}
- private lazy val numParallelism: Int = math.min(math.max(unsafeRows.length,
1),
- sqlContext.sparkContext.defaultParallelism)
-
- private lazy val rdd = sqlContext.sparkContext.parallelize(unsafeRows,
numParallelism)
+ @transient private lazy val rdd: RDD[InternalRow] = {
+ if (rows.isEmpty) {
+ sqlContext.sparkContext.emptyRDD
+ } else {
+ val numSlices = math.min(unsafeRows.length,
sqlContext.sparkContext.defaultParallelism)
+ sqlContext.sparkContext.parallelize(unsafeRows, numSlices)
Review comment:
Just in case, does it make sense to put this code (handling empty rows)
inside of `parallelize`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]