Skip to content

Commit

Permalink
Add a test for the case of WholeStageCodegen enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
sarutak committed Sep 8, 2020
1 parent fdc858e commit c506803
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,6 @@ case class RangeExec(range: org.apache.spark.sql.catalyst.plans.logical.Range)
RangeExec(range.canonicalized.asInstanceOf[org.apache.spark.sql.catalyst.plans.logical.Range])
}



override def inputRDDs(): Seq[RDD[InternalRow]] = {
val rdd = if (isEmptyRange) {
new EmptyRDD[InternalRow](sqlContext.sparkContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,12 @@ class PlannerSuite extends SharedSparkSession with AdaptiveSparkPlanHelper {
}

test("Change the number of partitions to zero when a range is empty") {
withSQLConf(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> "true") {
val range = spark.range(1, 1, 1, 1000)
val numPartitions = range.rdd.getNumPartitions
assert(numPartitions == 0)
}

withSQLConf(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> "false") {
val range = spark.range(1, 1, 1, 1000)
val numPartitions = range.rdd.getNumPartitions
Expand Down

0 comments on commit c506803

Please sign in to comment.