[SPARK-XXXXX][SQL][TESTS] Drop redundant BeforeAndAfterEach and SharedSparkSession mixins#55819
Draft
zhengruifeng wants to merge 1 commit into
Draft
[SPARK-XXXXX][SQL][TESTS] Drop redundant BeforeAndAfterEach and SharedSparkSession mixins#55819zhengruifeng wants to merge 1 commit into
zhengruifeng wants to merge 1 commit into
Conversation
…dSparkSession mixins SharedSparkSession transitively extends BeforeAndAfterEach (via SharedSparkSessionBase), so explicit `with BeforeAndAfterEach` alongside SharedSparkSession is redundant. StreamTest extends SharedSparkSession, so explicit `with SharedSparkSession` after StreamTest is redundant. This change drops: - `with BeforeAndAfterEach` from 5 suites whose base already provides it: StreamingSourceEvolutionSuite, RocksDBTimestampEncoderOperationsSuite, ResolveChangelogTableNetChangesTestsBase, ResolveChangelogTablePostProcessingSuite, ResolveChangelogTableStreamingPostProcessingSuite. - `with SharedSparkSession` from 5 StreamTest-based suites: ForeachWriterSuite, FileStreamSourceTest, TextSocketStreamSuite, OperatorStateMetadataSuite, RocksDBCheckpointFailureInjectionSuite. Unused `BeforeAndAfterEach` / `SharedSparkSession` imports are also removed. Suites that mix in the older `org.scalatest.BeforeAndAfter` (singular) trait keep it - that's a distinct API, not redundant. Generated-by: Claude Code
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?
Two related cleanups in
sql/coretest suites:Drop redundant
with BeforeAndAfterEach(5 files).SharedSparkSessiontransitively mixes inBeforeAndAfterEachviaSharedSparkSessionBase, so listing it again is redundant:StreamingSourceEvolutionSuite(the explicit mixin sat afterStreamTest, which already chains toSharedSparkSession)RocksDBTimestampEncoderOperationsSuiteResolveChangelogTableNetChangesTestsBase(trait)ResolveChangelogTablePostProcessingSuiteResolveChangelogTableStreamingPostProcessingSuiteDrop redundant
with SharedSparkSessionafterStreamTest(5 files).StreamTest extends SharedSparkSession with TimeLimits, so listingSharedSparkSessionagain adds nothing:ForeachWriterSuiteFileStreamSourceTest(the abstract base used byFileStreamSourceSuite/FileStreamSourceStressTestSuite)TextSocketStreamSuiteOperatorStateMetadataSuiteRocksDBCheckpointFailureInjectionSuiteUnused imports of
org.scalatest.BeforeAndAfterEachandorg.apache.spark.sql.test.SharedSparkSessionare removed alongside.Suites that mix in the older
org.scalatest.BeforeAndAfter(singular, e.g.ForeachWriterSuite,SaveLoadSuite) keep it - that is a distinct trait with its ownafter { ... }block syntax, not a redundant alias forBeforeAndAfterEach.SaveLoadSuiteis intentionally untouched: its baseDataSourceTestextendsQueryTest(notSharedSparkSession), so the explicitwith SharedSparkSessionthere is load-bearing.Why are the changes needed?
SharedSparkSessionalready extendsQueryTest with SharedSparkSessionBase, andSharedSparkSessionBasealready mixes inBeforeAndAfterEach.StreamTestalready extendsSharedSparkSession. Repeating these in extends clauses adds noise and gives the false impression they are independently required, which makes it easy for the pattern to spread to new suites.Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existing tests;
build/sbt sql/Test/compilepasses cleanly on the affected sources.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code