Skip to content

Commit

Permalink
rdar://113781872: Enable BosonShuffleManager in Spark 3.4 (apache#1845)
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya authored and GitHub Enterprise committed Aug 12, 2023
1 parent f06119f commit 714b4f1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
5 changes: 5 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,11 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.apple.pie.boson</groupId>
<artifactId>boson-spark-spark${spark.version.short}_${scala.binary.version}</artifactId>
</dependency>

<!--
This spark-tags test-dep is needed even though it isn't used in this module, otherwise testing-cmds that exclude
them will yield errors.
Expand Down
16 changes: 15 additions & 1 deletion core/src/main/scala/org/apache/spark/SparkEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import scala.collection.concurrent
import scala.collection.mutable
import scala.util.Properties

import com.apple.boson.BosonConf
import com.google.common.cache.CacheBuilder
import org.apache.hadoop.conf.Configuration

Expand Down Expand Up @@ -316,7 +317,20 @@ object SparkEnv extends Logging {
val shortShuffleMgrNames = Map(
"sort" -> classOf[org.apache.spark.shuffle.sort.SortShuffleManager].getName,
"tungsten-sort" -> classOf[org.apache.spark.shuffle.sort.SortShuffleManager].getName)
val shuffleMgrName = conf.get(config.SHUFFLE_MANAGER)
val shuffleMgrName = {
val bosonEnv = System.getenv("BOSON")
val bosonEnabled =
conf.getBoolean(BosonConf.BOSON_ENABLED.key, bosonEnv == null || bosonEnv.toBoolean)
val bosonShuffleEnabled = conf.getBoolean(BosonConf.BOSON_EXEC_SHUFFLE_ENABLED.key, false)

if (!conf.contains(config.SHUFFLE_MANAGER) && bosonEnabled && bosonShuffleEnabled) {
// If no custom shuffle manager is specified, and Boson is enabled,
// use Boson shuffle manager.
"org.apache.spark.sql.boson.execution.shuffle.BosonShuffleManager"
} else {
conf.get(config.SHUFFLE_MANAGER)
}
}
val shuffleMgrClass =
shortShuffleMgrNames.getOrElse(shuffleMgrName.toLowerCase(Locale.ROOT), shuffleMgrName)
val shuffleManager = Utils.instantiateSerializerOrShuffleManager[ShuffleManager](
Expand Down

0 comments on commit 714b4f1

Please sign in to comment.