Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,12 @@ object SQLConf {
.timeConf(TimeUnit.SECONDS)
.createWithDefaultString(s"${5 * 60}")

val MAX_BROADCAST_TABLE_SIZE = buildConf("spark.sql.maxBroadcastTableSize")
.doc("The maximum table size in bytes that can be broadcast in broadcast joins.")
.version("4.1.0")
.bytesConf(ByteUnit.BYTE)
.createWithDefault(8L << 30)

val INTERRUPT_ON_CANCEL = buildConf("spark.sql.execution.interruptOnCancel")
.doc("When true, all running tasks will be interrupted if one cancels a query.")
.version("4.0.0")
Expand Down Expand Up @@ -6155,6 +6161,8 @@ class SQLConf extends Serializable with Logging with SqlApiConf {
if (timeoutValue < 0) Long.MaxValue else timeoutValue
}

def maxBroadcastTableSizeInBytes: Long = getConf(MAX_BROADCAST_TABLE_SIZE)

def defaultDataSourceName: String = getConf(DEFAULT_DATA_SOURCE_NAME)

def convertCTAS: Boolean = getConf(CONVERT_CTAS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ trait BroadcastExchangeLike extends Exchange {
case class BroadcastExchangeExec(
mode: BroadcastMode,
child: SparkPlan) extends BroadcastExchangeLike {
import BroadcastExchangeExec._

override lazy val metrics = Map(
"dataSize" -> SQLMetrics.createSizeMetric(sparkContext, "data size"),
Expand Down Expand Up @@ -203,9 +202,10 @@ case class BroadcastExchangeExec(
}

longMetric("dataSize") += dataSize
if (dataSize >= MAX_BROADCAST_TABLE_BYTES) {
val maxBroadcastTableSizeInBytes = conf.maxBroadcastTableSizeInBytes
if (dataSize >= maxBroadcastTableSizeInBytes) {
throw QueryExecutionErrors.cannotBroadcastTableOverMaxTableBytesError(
MAX_BROADCAST_TABLE_BYTES, dataSize)
maxBroadcastTableSizeInBytes, dataSize)
}

val beforeBroadcast = System.nanoTime()
Expand Down Expand Up @@ -268,8 +268,6 @@ case class BroadcastExchangeExec(
}

object BroadcastExchangeExec {
val MAX_BROADCAST_TABLE_BYTES = 8L << 30

private[execution] val executionContext = ExecutionContext.fromExecutorService(
ThreadUtils.newDaemonCachedThreadPool("broadcast-exchange",
SQLConf.get.getConf(StaticSQLConf.BROADCAST_EXCHANGE_MAX_THREAD_THRESHOLD)))
Expand Down