Skip to content

Commit 022c945

Browse files
committed
Add test coverage for maxBroadcastTableSize config enforcement
1 parent c3473e4 commit 022c945

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

sql/core/src/test/scala/org/apache/spark/sql/execution/BroadcastExchangeSuite.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,23 @@ class BroadcastExchangeSuite extends SparkPlanTest
113113
broadcastExchangeNode.resetMetrics()
114114
assert(metrics("numOutputRows").value == 1)
115115
}
116+
117+
test("SPARK-56455: maxBroadcastTableSize config enforcement") {
118+
withSQLConf(SQLConf.MAX_BROADCAST_TABLE_SIZE.key -> "104857600") {
119+
val df = spark.range(100).toDF()
120+
val joinDF = df.join(broadcast(df), "id")
121+
assert(joinDF.collect().length == 100)
122+
}
123+
124+
withSQLConf(SQLConf.MAX_BROADCAST_TABLE_SIZE.key -> "100") {
125+
val df = spark.range(1000).toDF()
126+
val joinDF = df.join(broadcast(df), "id")
127+
val ex = intercept[SparkException] {
128+
joinDF.collect()
129+
}
130+
assert(ex.getCondition == "_LEGACY_ERROR_TEMP_2249")
131+
}
132+
}
116133
}
117134

118135
// Additional tests run in 'local-cluster' mode.

0 commit comments

Comments
 (0)