{{ message }}
[SPARK-56591][SQL][TESTS] Remove redundant QueryTest mixin from SharedSparkSession subclasses#55503
Open
zhengruifeng wants to merge 4 commits intoapache:masterfrom
Open
Conversation
…dSparkSession subclasses ### What changes were proposed in this pull request? Since `SharedSparkSession` already extends `QueryTest` (`trait SharedSparkSession extends QueryTest with SharedSparkSessionBase`), mixing `QueryTest` in again alongside `SharedSparkSession` in the `extends` list is a no-op. Mechanical cleanup across 242 test files in `sql-core`, `sql-hive`, `sql-hive-thriftserver`, `sql-connect`, `sql-kafka-0-10`, `avro`, `protobuf`, and `docker-integration-tests`: - `extends QueryTest with SharedSparkSession` -> `extends SharedSparkSession` - `extends QueryTest with ParquetTest with SharedSparkSession` -> `extends ParquetTest with SharedSparkSession` (`ParquetTest` transitively extends `QueryTest` as well) - `extends QueryTest with test.SharedSparkSession` -> `extends test.SharedSparkSession` (in `QueryTestSuite`) - multi-line variants (`extends QueryTest\n with SharedSparkSession`) handled the same way - removed the now-unused `QueryTest` imports where the file no longer referenced it Intentionally left untouched: - `SharedSparkSession` itself (its own definition) - traits that extend `QueryTest` but not `SharedSparkSession` (e.g. `CharVarcharTestSuite`, `V1WriteCommandSuiteBase`) - files that still use `QueryTest.checkAnswer` / `QueryTest.compare` / `QueryTest.sameRows` statically (imports kept) ### Why are the changes needed? Remove redundant trait mixin and the resulting dead `QueryTest` imports so that the `extends` lists faithfully describe the class hierarchy and scalastyle's unused-import check stays clean. ### Does this PR introduce _any_ user-facing change? No, this only touches test-suite class declarations. ### How was this patch tested? `build/sbt sql/Test/compile connect/Test/compile hive/Test/compile avro/Test/compile protobuf/Test/compile sql-kafka-0-10/Test/compile docker-integration-tests/Test/compile` and `build/sbt -Phive-thriftserver hive-thriftserver/Test/compile` both pass. ### Was this patch authored or co-authored using generative AI tooling? Yes, generated by Claude Code. Co-authored-by: Isaac
…rt in AvroRowReaderSuite ### What changes were proposed in this pull request? CI flagged `import org.apache.spark.sql._` in `AvroRowReaderSuite.scala` as an unused import after the prior commit removed `QueryTest` from the `extends` list — the wildcard's only consumer was `QueryTest`. Drop the wildcard. The file still imports everything it needs explicitly (`SparkConf`, `catalyst`, `types._`, `SharedSparkSession`, etc.). ### Why are the changes needed? Fix the `-Wconf:cat=unused-imports:error` compile failure in the avro module, which cascades into every downstream `sql`/`hive` test job. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? `build/sbt avro/Test/compile` succeeds locally. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (model: claude-opus-4-7) Co-authored-by: Isaac
…tions after QueryTest mixin removal
### What changes were proposed in this pull request?
Two mechanical cleanups in files already touched by the QueryTest mixin removal:
1. Drop the redundant brace group from single-item imports left behind when `QueryTest, ` was removed from the import list, e.g.
`import org.apache.spark.sql.{AnalysisException}` -> `import org.apache.spark.sql.AnalysisException` (37 files).
2. Collapse `class X\n extends SharedSparkSession {` onto one line when the result fits within 100 chars (7 files, e.g. `MetadataResolverSuite`, `AvroRowReaderSuite`).
### Why are the changes needed?
Keeps the imports and class declarations in their canonical single-line form so reviewers do not need to flag the leftover formatting artifacts from the sed-based cleanup.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
`build/sbt sql/Test/compile avro/Test/compile connect/Test/compile` passes.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (model: claude-opus-4-7)
Co-authored-by: Isaac
…yContextSuite ### What changes were proposed in this pull request? `QueryContextSuite.summary of DataFrame context` asserts against a `QueryContextSuite.scala:<N>` string that refers back to the test's own source line. Removing `import org.apache.spark.sql.QueryTest` in the first commit shifted every subsequent line down by 1, so the expected literal `:33` needs to become `:32`. ### Why are the changes needed? Fix the only in-tree test that failed after the mixin cleanup. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? `build/sbt "sql/testOnly org.apache.spark.sql.errors.QueryContextSuite"` passes. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (model: claude-opus-4-7) Co-authored-by: Isaac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What changes were proposed in this pull request?
Since
SharedSparkSessionalready extendsQueryTest(trait SharedSparkSession extends QueryTest with SharedSparkSessionBase), mixingQueryTestin again alongsideSharedSparkSessionin theextendslist is a no-op. Linearization:Mechanical cleanup across 242 test files in
sql-core,sql-hive,sql-hive-thriftserver,sql-connect,sql-kafka-0-10,avro,protobuf, anddocker-integration-tests:extends QueryTest with SharedSparkSession->extends SharedSparkSessionextends QueryTest with ParquetTest with SharedSparkSession->extends ParquetTest with SharedSparkSession(ParquetTest -> FileBasedDataSourceTest -> QueryTest, soQueryTestis already brought in twice)extends QueryTest with test.SharedSparkSession->extends test.SharedSparkSession(QueryTestSuiteinQueryTest.scala)extends QueryTest\n with SharedSparkSession) handled the same wayQueryTestimports where the file no longer referenced it; kept the import when the file still usesQueryTest.checkAnswer/QueryTest.compare/QueryTest.sameRowsstaticallyIntentionally left untouched:
SharedSparkSessionitself (its own definition)QueryTestbut notSharedSparkSession(e.g.CharVarcharTestSuite,V1WriteCommandSuiteBase)Why are the changes needed?
Removes a redundant trait mixin and the resulting dead
QueryTestimports, so theextendslists faithfully describe the class hierarchy and scalastyle's unused-import check stays clean.Does this PR introduce any user-facing change?
No. Test-only class-declaration cleanup.
How was this patch tested?
Existing tests. The affected modules compile cleanly:
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (model: claude-opus-4-7)