Skip to content

Commit db4b6eb

Browse files
schenksjclaude
andcommitted
test(delta-regression): make Delta 2.4.0 diff install Comet extensions
Delta 2.4.0's DeltaTestSparkSession hard-codes its `extensions` override to install ONLY DeltaSparkSessionExtension -- a workaround for SPARK-25003 (Spark 2.4.x didn't read spark.sql.extensions reliably) that was never cleaned up even though 2.4.0 targets Spark 3.4. That override bypasses CometDriverPlugin's mechanism for injecting CometSparkSessionExtensions via spark.sql.extensions, so Comet's rules never install and nothing gets rewritten -- the plan contains plain FileScan parquet + ColumnarToRow instead of CometScan / CometFilter / etc. Update the 2.4.0 diff so DeltaTestSparkSession ALSO iterates over spark.sql.extensions (read from the live SparkContext conf, since CometDriverPlugin sets the key during context init AFTER the constructor captured sparkConf) and applies each entry as a SparkSessionExtensions => Unit. Failures are logged to stderr so future drift is visible. With this: - CometSmokeTest: both tests pass - DeltaTimeTravelSuite: 23/23 tests pass Spark 3.4 / Delta 2.4.0 now fully validates end-to-end, matching the 3.5/3.3.2 leg. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bf38729 commit db4b6eb

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

dev/diffs/delta/2.4.0.diff

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,40 @@ index 0b8c556..685d045 100644
125125
_hiveContext = new TestHiveContext(_sc)
126126
_session = _hiveContext.sparkSession
127127
diff --git a/core/src/test/scala/org/apache/spark/sql/delta/test/DeltaSQLCommandTest.scala b/core/src/test/scala/org/apache/spark/sql/delta/test/DeltaSQLCommandTest.scala
128-
index b712972..97cbebc 100644
128+
index b712972..12b45aa 100644
129129
--- a/core/src/test/scala/org/apache/spark/sql/delta/test/DeltaSQLCommandTest.scala
130130
+++ b/core/src/test/scala/org/apache/spark/sql/delta/test/DeltaSQLCommandTest.scala
131-
@@ -46,7 +46,19 @@ trait DeltaSQLCommandTest { self: SharedSparkSession =>
131+
@@ -34,6 +34,29 @@ class DeltaTestSparkSession(sparkConf: SparkConf) extends TestSparkSession(spark
132+
override val extensions: SparkSessionExtensions = {
133+
val extensions = new SparkSessionExtensions
134+
new DeltaSparkSessionExtension().apply(extensions)
135+
+ // Delta 2.4.0's hard-coded `extensions` override bypasses `spark.sql.extensions` as a
136+
+ // workaround for SPARK-25003. Re-apply any extensions named in the conf (e.g. Comet's
137+
+ // `CometSparkSessionExtensions`) so plugin-installed rules still activate.
138+
+ //
139+
+ // Read from the LIVE SparkContext conf rather than the constructor's `sparkConf`. Comet's
140+
+ // DriverPlugin sets `spark.sql.extensions` during SparkContext init, which happens after
141+
+ // `sparkConf` was captured but before `extensions` is evaluated.
142+
+ val liveConf = org.apache.spark.SparkContext.getOrCreate().getConf
143+
+ val extraExtensions = liveConf.get("spark.sql.extensions", "")
144+
+ .split(',').map(_.trim).filter(_.nonEmpty)
145+
+ extraExtensions.foreach { className =>
146+
+ try {
147+
+ val cls = Class.forName(className)
148+
+ val instance = cls.getDeclaredConstructor().newInstance()
149+
+ .asInstanceOf[SparkSessionExtensions => Unit]
150+
+ instance.apply(extensions)
151+
+ } catch {
152+
+ case t: Throwable =>
153+
+ // Surface failures in stderr so drift in CometSparkSessionExtensions is visible.
154+
+ System.err.println(
155+
+ s"[DeltaTestSparkSession] failed to apply extension $className: $t")
156+
+ }
157+
+ }
158+
extensions
159+
}
160+
}
161+
@@ -46,7 +69,19 @@ trait DeltaSQLCommandTest { self: SharedSparkSession =>
132162

133163
override protected def createSparkSession: TestSparkSession = {
134164
SparkSession.cleanupAnyExistingSession()

0 commit comments

Comments
 (0)