cloud-fan commented on a change in pull request #26516: [SPARK-29893] improve
the local shuffle reader performance by changing the reading task number from 1
to multi.
URL: https://github.com/apache/spark/pull/26516#discussion_r347730919
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
##########
@@ -103,6 +103,64 @@ class AdaptiveQueryExecSuite
}
}
+ test("Reuse the parallelism of CoalescedShuffleReaderExec as the tasks" +
+ " of LocalShuffleReaderExec") {
+ withSQLConf(
+ SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
+ SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "80",
+ SQLConf.SHUFFLE_TARGET_POSTSHUFFLE_INPUT_SIZE.key -> "150") {
+ val (plan, adaptivePlan) = runAdaptiveAndVerifyResult(
+ "SELECT * FROM testData join testData2 ON key = a where value = '1'")
+ val smj = findTopLevelSortMergeJoin(plan)
+ assert(smj.size == 1)
+ val bhj = findTopLevelBroadcastHashJoin(adaptivePlan)
+ assert(bhj.size == 1)
+ val localReaders = collect(adaptivePlan) {
+ case reader: LocalShuffleReaderExec => reader
+ }
+ // The pre-shuffle partition size is [0, 0, 0, 72, 0]
+ assert(localReaders(0).advisoryParallelism.get == 1)
+ // The pre-shuffle partition size is [0, 72, 0, 72, 126]
+ assert(localReaders(1).advisoryParallelism.get == 2)
+ val localShuffleRDD0 =
localReaders(0).getLocalShuffleRDD().asInstanceOf[LocalShuffledRowRDD]
+ val localShuffleRDD1 =
localReaders(1).getLocalShuffleRDD().asInstanceOf[LocalShuffledRowRDD]
+ // the final parallelism is
+ // math.max(1, advisoryParallelism / numMappers): math.max(1, 1/2) = 1
+ // and the partitions length is 1 * numMappers = 2
+ assert(localShuffleRDD0.getPartitions.length == 2)
+ // the final parallelism is
+ // math.max(1, advisoryParallelism / numMappers): math.max(1, 2 / 2) =1
+ // and the partitions length is 1 * numMappers = 2
+ assert(localShuffleRDD1.getPartitions.length == 2)
+ }
+ }
+
+ test("Use the default parallelism as the tasks" +
Review comment:
ditto
----------------------------------------------------------------
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]