From ef927b12a3f205b3c066e6078b7c8e1947d66c4c Mon Sep 17 00:00:00 2001 From: Pratham Manja Date: Mon, 13 Apr 2026 01:05:10 +0530 Subject: [PATCH] Add test coverage for maxBroadcastTableSize config enforcement --- .../spark/sql/execution/BroadcastExchangeSuite.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/BroadcastExchangeSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/BroadcastExchangeSuite.scala index 8d6ee83f5e6b7..5a98480138845 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/BroadcastExchangeSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/BroadcastExchangeSuite.scala @@ -113,6 +113,17 @@ class BroadcastExchangeSuite extends SparkPlanTest broadcastExchangeNode.resetMetrics() assert(metrics("numOutputRows").value == 1) } + + test("SPARK-56455: broadcast should fail when table size exceeds maxBroadcastTableSize") { + withSQLConf(SQLConf.MAX_BROADCAST_TABLE_SIZE.key -> "100") { + val df = spark.range(1000).toDF() + val joinDF = df.join(broadcast(df), "id") + val ex = intercept[SparkException] { + joinDF.collect() + } + assert(ex.getCondition == "_LEGACY_ERROR_TEMP_2249") + } + } } // Additional tests run in 'local-cluster' mode.