JoshRosen commented on a change in pull request #34158:
URL: https://github.com/apache/spark/pull/34158#discussion_r721804140



##########
File path: core/src/main/scala/org/apache/spark/util/Utils.scala
##########
@@ -2603,17 +2603,19 @@ private[spark] object Utils extends Logging {
    *   - IO encryption disabled
    *   - serializer(such as KryoSerializer) supports relocation of serialized 
objects
    */
-  def isPushBasedShuffleEnabled(conf: SparkConf): Boolean = {
+  def isPushBasedShuffleEnabled(conf: SparkConf,
+      isDriver: Boolean,
+      checkSerializer: Boolean = true): Boolean = {
     val pushBasedShuffleEnabled = conf.get(PUSH_BASED_SHUFFLE_ENABLED)
     if (pushBasedShuffleEnabled) {
-      val serializer = 
Utils.classForName(conf.get(SERIALIZER)).getConstructor(classOf[SparkConf])
-        .newInstance(conf).asInstanceOf[Serializer]
+      lazy val serializer = Option(SparkEnv.get).map(_.serializer)
+        .getOrElse(instantiateClassFromConf[Serializer](SERIALIZER, conf, 
isDriver))
       val canDoPushBasedShuffle = conf.get(IS_TESTING).getOrElse(false) ||

Review comment:
       Regarding `IS_TESTING`: 
   
   It looks like the `DAGSchedulerSuite` test cases are testing push-based 
shuffle's impact on task scheduling (e.g. to ensure that locality is properly 
taken into account). Spark's default `JavaSerializer` doesn't support object 
relocation, so my suggested logic would result in PBS being disabled for these 
test cases. PBS doesn't work correctly with `JavaSerializer` but I guess that's 
not a problem for this test case because we're not actually checking the 
correctness of the results here (just the scheduling logic).
   
   Part of me wonders if we should set `spark.serializer` to Kryo in that suite 
instead of modifying the `canDoPushBasedShuffle` logic to accommodate that 
suite.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to