This is an automated email from the ASF dual-hosted git repository.
zhengruifeng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 4678f7178b7a [SPARK-56591][SQL][TESTS][FOLLOW-UP] Drop redundant
QueryTest mixin from SharedSparkSession-based test suites
4678f7178b7a is described below
commit 4678f7178b7a1144d9d373f42c7ec6a0fba62283
Author: Ruifeng Zheng <[email protected]>
AuthorDate: Tue May 12 09:06:02 2026 +0800
[SPARK-56591][SQL][TESTS][FOLLOW-UP] Drop redundant QueryTest mixin from
SharedSparkSession-based test suites
### What changes were proposed in this pull request?
Drop the redundant `QueryTest` term from `extends QueryTest with
SharedSparkSession` (and its multi-line variants) across 11 test suites in
`sql/core`. Where `QueryTest` was only imported to satisfy the extends clause,
the import is also removed.
Affected files:
-
`sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2ExtSessionColumnIdSuite.scala`
-
`sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataTableSuite.scala`
-
`sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataViewSuite.scala`
-
`sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTableNetChangesSuite.scala`
-
`sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTablePostProcessingSuite.scala`
-
`sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTableStreamingPostProcessingSuite.scala`
-
`sql/core/src/test/scala/org/apache/spark/sql/execution/MetricViewV2CatalogSuite.scala`
-
`sql/core/src/test/scala/org/apache/spark/sql/execution/UnionCodegenSuite.scala`
-
`sql/core/src/test/scala/org/apache/spark/sql/execution/window/SegmentTreeWindowFunctionSuite.scala`
-
`sql/core/src/test/scala/org/apache/spark/sql/execution/window/SegmentTreeWindowMetricsSuite.scala`
-
`sql/core/src/test/scala/org/apache/spark/sql/execution/window/WindowSegmentTreeAllowlistSuite.scala`
Suites that reference `QueryTest.<member>` in the body (only
`SegmentTreeWindowFunctionSuite` via `QueryTest.sameRows`) keep the import.
### Why are the changes needed?
`SharedSparkSession` already extends `QueryTest`:
```scala
trait SharedSparkSession extends QueryTest with SharedSparkSessionBase
```
so an explicit `extends QueryTest with SharedSparkSession` on each suite is
redundant and slightly misleading about the trait hierarchy. Dropping it
reduces noise and lowers the chance of the pattern being copied into new suites.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Existing tests; `build/sbt sql/Test/compile` passes cleanly on the affected
sources.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code
Closes #55792 from zhengruifeng/cleanup-querytest-mixin.
Authored-by: Ruifeng Zheng <[email protected]>
Signed-off-by: Ruifeng Zheng <[email protected]>
---
.../spark/sql/connector/DataSourceV2ExtSessionColumnIdSuite.scala | 4 ++--
.../apache/spark/sql/connector/DataSourceV2MetadataTableSuite.scala | 4 ++--
.../apache/spark/sql/connector/DataSourceV2MetadataViewSuite.scala | 4 ++--
.../spark/sql/connector/ResolveChangelogTableNetChangesSuite.scala | 5 ++---
.../sql/connector/ResolveChangelogTablePostProcessingSuite.scala | 5 ++---
.../ResolveChangelogTableStreamingPostProcessingSuite.scala | 5 ++---
.../org/apache/spark/sql/execution/MetricViewV2CatalogSuite.scala | 4 ++--
.../scala/org/apache/spark/sql/execution/UnionCodegenSuite.scala | 4 ++--
.../spark/sql/execution/window/SegmentTreeWindowFunctionSuite.scala | 2 +-
.../spark/sql/execution/window/SegmentTreeWindowMetricsSuite.scala | 3 +--
.../spark/sql/execution/window/WindowSegmentTreeAllowlistSuite.scala | 4 ++--
11 files changed, 20 insertions(+), 24 deletions(-)
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2ExtSessionColumnIdSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2ExtSessionColumnIdSuite.scala
index ed46f33e7df0..ecc1dcccec1d 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2ExtSessionColumnIdSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2ExtSessionColumnIdSuite.scala
@@ -18,7 +18,7 @@
package org.apache.spark.sql.connector
import org.apache.spark.SparkConf
-import org.apache.spark.sql.{AnalysisException, QueryTest, Row, SparkSession}
+import org.apache.spark.sql.{AnalysisException, Row, SparkSession}
import org.apache.spark.sql.connector.catalog.SharedInMemoryTableCatalog
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.SharedSparkSession
@@ -38,7 +38,7 @@ import org.apache.spark.sql.test.SharedSparkSession
* a static [[ConcurrentHashMap]] that all catalog instances share,
* regardless of which session created them.
*/
-class DataSourceV2ExtSessionColumnIdSuite extends QueryTest with
SharedSparkSession {
+class DataSourceV2ExtSessionColumnIdSuite extends SharedSparkSession {
override protected def sparkConf: SparkConf = super.sparkConf
.set(SQLConf.ANSI_ENABLED, true)
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataTableSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataTableSuite.scala
index 37acbf1e0442..42fa148106df 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataTableSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataTableSuite.scala
@@ -18,7 +18,7 @@
package org.apache.spark.sql.connector
import org.apache.spark.SparkConf
-import org.apache.spark.sql.{QueryTest, Row}
+import org.apache.spark.sql.Row
import org.apache.spark.sql.catalyst.analysis.NoSuchTableException
import org.apache.spark.sql.connector.catalog.{Identifier, MetadataTable,
Table, TableCatalog, TableChange, TableInfo, TableSummary}
import org.apache.spark.sql.connector.expressions.LogicalExpressions
@@ -31,7 +31,7 @@ import org.apache.spark.sql.util.CaseInsensitiveStringMap
* metadata-only tables and Spark reads / writes them via the V1 data-source
path.
* View-related paths live in [[DataSourceV2MetadataViewSuite]].
*/
-class DataSourceV2MetadataTableSuite extends QueryTest with SharedSparkSession
{
+class DataSourceV2MetadataTableSuite extends SharedSparkSession {
import testImplicits._
override def sparkConf: SparkConf = super.sparkConf
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataViewSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataViewSuite.scala
index 163c0957e0d0..969ebb540ae6 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataViewSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2MetadataViewSuite.scala
@@ -18,7 +18,7 @@
package org.apache.spark.sql.connector
import org.apache.spark.SparkConf
-import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.{AnalysisException, Row}
import org.apache.spark.sql.catalyst.analysis.{NoSuchTableException,
NoSuchViewException, TableAlreadyExistsException, ViewAlreadyExistsException}
import org.apache.spark.sql.connector.catalog.{Identifier, MetadataTable,
Table, TableCatalog, TableChange, TableInfo, TableSummary, TableViewCatalog,
V1Table, ViewCatalog, ViewInfo}
import org.apache.spark.sql.internal.SQLConf
@@ -39,7 +39,7 @@ import org.apache.spark.sql.util.CaseInsensitiveStringMap
* [[org.apache.spark.sql.execution.PersistedViewTestSuite]] body against the
v2 path for full
* parity with the v1 persisted-view coverage.
*/
-class DataSourceV2MetadataViewSuite extends QueryTest with SharedSparkSession {
+class DataSourceV2MetadataViewSuite extends SharedSparkSession {
import testImplicits._
override def sparkConf: SparkConf = super.sparkConf
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTableNetChangesSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTableNetChangesSuite.scala
index 6ed5070e4f54..33e97de95758 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTableNetChangesSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTableNetChangesSuite.scala
@@ -21,7 +21,7 @@ import java.util.Collections
import org.scalatest.BeforeAndAfterEach
-import org.apache.spark.sql.{DataFrame, QueryTest, Row}
+import org.apache.spark.sql.{DataFrame, Row}
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.connector.catalog.{
ChangelogProperties, Column, Identifier, InMemoryChangelogCatalog}
@@ -55,8 +55,7 @@ import org.apache.spark.unsafe.types.UTF8String
* the same `_change_type` labels at the netChanges input.
*/
trait ResolveChangelogTableNetChangesTestsBase
- extends QueryTest
- with SharedSparkSession
+ extends SharedSparkSession
with BeforeAndAfterEach {
/**
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTablePostProcessingSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTablePostProcessingSuite.scala
index c48ced72a15c..e0f426abe5d2 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTablePostProcessingSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTablePostProcessingSuite.scala
@@ -22,7 +22,7 @@ import java.util.Collections
import org.scalatest.BeforeAndAfterEach
import org.apache.spark.SparkRuntimeException
-import org.apache.spark.sql.{AnalysisException, QueryTest, Row}
+import org.apache.spark.sql.{AnalysisException, Row}
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.streaming.StreamingRelationV2
import org.apache.spark.sql.connector.catalog.{
@@ -48,8 +48,7 @@ import org.apache.spark.unsafe.types.UTF8String
* correctly transforms the plan and produces the expected output.
*/
class ResolveChangelogTablePostProcessingSuite
- extends QueryTest
- with SharedSparkSession
+ extends SharedSparkSession
with BeforeAndAfterEach {
private val catalogName = "cdc_test_catalog"
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTableStreamingPostProcessingSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTableStreamingPostProcessingSuite.scala
index 3dc1cf506d33..7b72568c460a 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTableStreamingPostProcessingSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/connector/ResolveChangelogTableStreamingPostProcessingSuite.scala
@@ -21,7 +21,7 @@ import java.util.Collections
import org.scalatest.BeforeAndAfterEach
-import org.apache.spark.sql.{DataFrame, QueryTest}
+import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.catalyst.expressions.Inline
import org.apache.spark.sql.catalyst.plans.logical.{
Aggregate, EventTimeWatermark, Filter, Generate, LogicalPlan, Project,
TransformWithState}
@@ -47,8 +47,7 @@ import org.apache.spark.sql.types.LongType
* -> Project (drop helper columns)
*/
class ResolveChangelogTableStreamingPostProcessingSuite
- extends QueryTest
- with SharedSparkSession
+ extends SharedSparkSession
with BeforeAndAfterEach {
private val catalogName = "cdc_streaming_pp"
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/execution/MetricViewV2CatalogSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/execution/MetricViewV2CatalogSuite.scala
index 54caafe7b5f1..a90adb8fee61 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/execution/MetricViewV2CatalogSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/execution/MetricViewV2CatalogSuite.scala
@@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap
import scala.jdk.CollectionConverters._
-import org.apache.spark.sql.{AnalysisException, QueryTest}
+import org.apache.spark.sql.AnalysisException
import org.apache.spark.sql.catalyst.analysis.{NoSuchViewException,
ViewAlreadyExistsException}
import org.apache.spark.sql.connector.catalog.{Identifier,
InMemoryTableCatalog, MetadataTable, Table, TableCatalog, TableDependency,
TableSummary, TableViewCatalog, ViewInfo}
import org.apache.spark.sql.metricview.serde.{AssetSource, Column, Constants,
DimensionExpression, MeasureExpression, MetricView, MetricViewFactory,
SQLSource}
@@ -36,7 +36,7 @@ import org.apache.spark.sql.types.Metadata
* minimal [[TableViewCatalog]] so the same instance can also host the source
table referenced by
* the metric view's YAML.
*/
-class MetricViewV2CatalogSuite extends QueryTest with SharedSparkSession {
+class MetricViewV2CatalogSuite extends SharedSparkSession {
import testImplicits._
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/execution/UnionCodegenSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/execution/UnionCodegenSuite.scala
index fe6ef1bc5e25..8cc35ed43a10 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/execution/UnionCodegenSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/execution/UnionCodegenSuite.scala
@@ -18,7 +18,7 @@
package org.apache.spark.sql.execution
import org.apache.spark.SparkConf
-import org.apache.spark.sql.{DataFrame, QueryTest, Row}
+import org.apache.spark.sql.{DataFrame, Row}
import org.apache.spark.sql.functions._
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.test.SharedSparkSession
@@ -28,7 +28,7 @@ import org.apache.spark.sql.types._
* Tests for `UnionExec` whole-stage codegen fusion: plan-shape assertions,
* correctness, type widening, metrics, and fallbacks.
*/
-class UnionCodegenSuite extends QueryTest with SharedSparkSession {
+class UnionCodegenSuite extends SharedSparkSession {
// Union codegen fusion is off by default; turn it on for this suite.
override protected def sparkConf: SparkConf =
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/execution/window/SegmentTreeWindowFunctionSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/execution/window/SegmentTreeWindowFunctionSuite.scala
index d6d18cff4df5..5e644cceb142 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/execution/window/SegmentTreeWindowFunctionSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/execution/window/SegmentTreeWindowFunctionSuite.scala
@@ -32,7 +32,7 @@ import org.apache.spark.util.SparkErrorUtils
* numeric/string/date-timestamp types, RANGE, Decimal/Binary merge, UDAF
* fallback, and frame lifecycle.
*/
-class SegmentTreeWindowFunctionSuite extends QueryTest with SharedSparkSession
{
+class SegmentTreeWindowFunctionSuite extends SharedSparkSession {
import testImplicits._
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/execution/window/SegmentTreeWindowMetricsSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/execution/window/SegmentTreeWindowMetricsSuite.scala
index 5c3edb7e06c6..d22c1cdc90da 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/execution/window/SegmentTreeWindowMetricsSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/execution/window/SegmentTreeWindowMetricsSuite.scala
@@ -17,7 +17,6 @@
package org.apache.spark.sql.execution.window
-import org.apache.spark.sql.QueryTest
import org.apache.spark.sql.execution.SparkPlanInfo
import org.apache.spark.sql.execution.metric.SQLMetricsTestUtils
import org.apache.spark.sql.execution.ui.SparkPlanGraph
@@ -32,7 +31,7 @@ import org.apache.spark.sql.test.SharedSparkSession
* `numSegmentTreeFallbackFrames`; feature-flag off leaves both at 0.
*/
class SegmentTreeWindowMetricsSuite
- extends QueryTest with SharedSparkSession with SQLMetricsTestUtils {
+ extends SharedSparkSession with SQLMetricsTestUtils {
import testImplicits._
diff --git
a/sql/core/src/test/scala/org/apache/spark/sql/execution/window/WindowSegmentTreeAllowlistSuite.scala
b/sql/core/src/test/scala/org/apache/spark/sql/execution/window/WindowSegmentTreeAllowlistSuite.scala
index d3da8e40c85a..236d38cc6a91 100644
---
a/sql/core/src/test/scala/org/apache/spark/sql/execution/window/WindowSegmentTreeAllowlistSuite.scala
+++
b/sql/core/src/test/scala/org/apache/spark/sql/execution/window/WindowSegmentTreeAllowlistSuite.scala
@@ -17,7 +17,7 @@
package org.apache.spark.sql.execution.window
-import org.apache.spark.sql.{DataFrame, QueryTest}
+import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.execution.SparkPlanInfo
import org.apache.spark.sql.execution.metric.SQLMetricsTestUtils
import org.apache.spark.sql.execution.ui.SparkPlanGraph
@@ -36,7 +36,7 @@ import org.apache.spark.sql.test.SharedSparkSession
* [[SegmentTreeWindowFunctionSuite]].
*/
class WindowSegmentTreeAllowlistSuite
- extends QueryTest with SharedSparkSession with SQLMetricsTestUtils {
+ extends SharedSparkSession with SQLMetricsTestUtils {
import testImplicits._
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]