Skip to content

Commit a552287

Browse files
committed
[SPARK-32524][SQL][TESTS] CachedBatchSerializerSuite should clean up InMemoryRelation.ser
1 parent f3b10f5 commit a552287

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/columnar/InMemoryRelation.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ object InMemoryRelation {
277277
ser.get
278278
}
279279

280+
/* Visible for testing */
281+
private[spark] def clearSerializer(): Unit = synchronized { ser = None }
282+
280283
def convertToColumnarIfPossible(plan: SparkPlan): SparkPlan = plan match {
281284
case gen: WholeStageCodegenExec => gen.child match {
282285
case c2r: ColumnarToRowTransition => c2r.child match {

sql/core/src/test/scala/org/apache/spark/sql/execution/columnar/CachedBatchSerializerSuite.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import org.apache.spark.sql.{QueryTest, Row}
2323
import org.apache.spark.sql.catalyst.InternalRow
2424
import org.apache.spark.sql.catalyst.expressions.{Attribute, Expression}
2525
import org.apache.spark.sql.columnar.{CachedBatch, CachedBatchSerializer}
26+
import org.apache.spark.sql.execution.columnar.InMemoryRelation.clearSerializer
2627
import org.apache.spark.sql.execution.vectorized.OnHeapColumnVector
2728
import org.apache.spark.sql.internal.{SQLConf, StaticSQLConf}
2829
import org.apache.spark.sql.test.SharedSparkSession
@@ -120,6 +121,11 @@ class CachedBatchSerializerSuite extends QueryTest with SharedSparkSession {
120121
classOf[TestSingleIntColumnarCachedBatchSerializer].getName)
121122
}
122123

124+
protected override def afterAll(): Unit = {
125+
clearSerializer()
126+
super.afterAll()
127+
}
128+
123129
test("Columnar Cache Plugin") {
124130
withTempPath { workDir =>
125131
val workDirPath = workDir.getAbsolutePath

0 commit comments

Comments
 (0)