Description
In Spark 4.1.0, the MAX_BROADCAST_TABLE_BYTES constant was removed from BroadcastExchangeExec object.
Spark 4.0.x
// org.apache.spark.sql.execution.exchange.BroadcastExchangeExec
val MAX_BROADCAST_TABLE_BYTES = 8L << 30 // 8GB
Spark 4.1.0
The constant was removed and replaced with a configurable value via conf.maxBroadcastTableSizeInBytes.
Impact
Code that imports BroadcastExchangeExec.MAX_BROADCAST_TABLE_BYTES will fail to compile against Spark 4.1.0:
object MAX_BROADCAST_TABLE_BYTES is not a member of object org.apache.spark.sql.execution.exchange.BroadcastExchangeExec
Affected Files
sql-plugin/src/main/scala/org/apache/spark/sql/rapids/execution/GpuBroadcastExchangeExec.scala
Solution
Create a shim BroadcastExchangeShims that:
- For Spark <= 4.0.x: references
BroadcastExchangeExec.MAX_BROADCAST_TABLE_BYTES
- For Spark 4.1.0+: defines the constant directly as
8L << 30 (the original hardcoded value)
Update GpuBroadcastExchangeExec.scala to import from the shim:
// Before
import org.apache.spark.sql.execution.exchange.BroadcastExchangeExec.MAX_BROADCAST_TABLE_BYTES
// After
import com.nvidia.spark.rapids.shims.BroadcastExchangeShims.MAX_BROADCAST_TABLE_BYTES
References
- Spark 4.0.1:
sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scala line 271
- Spark 4.1.0: Constant removed, now uses
conf.maxBroadcastTableSizeInBytes
Description
In Spark 4.1.0, the
MAX_BROADCAST_TABLE_BYTESconstant was removed fromBroadcastExchangeExecobject.Spark 4.0.x
Spark 4.1.0
The constant was removed and replaced with a configurable value via
conf.maxBroadcastTableSizeInBytes.Impact
Code that imports
BroadcastExchangeExec.MAX_BROADCAST_TABLE_BYTESwill fail to compile against Spark 4.1.0:Affected Files
sql-plugin/src/main/scala/org/apache/spark/sql/rapids/execution/GpuBroadcastExchangeExec.scalaSolution
Create a shim
BroadcastExchangeShimsthat:BroadcastExchangeExec.MAX_BROADCAST_TABLE_BYTES8L << 30(the original hardcoded value)Update
GpuBroadcastExchangeExec.scalato import from the shim:References
sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/BroadcastExchangeExec.scalaline 271conf.maxBroadcastTableSizeInBytes