Skip to content

[SPARK-56557][SQL][TESTS] Use abstract SparkSession in SparkPlanTest#55443

Closed
zhengruifeng wants to merge 1 commit into
apache:masterfrom
zhengruifeng:sql_spark_plan_test_abstract
Closed

[SPARK-56557][SQL][TESTS] Use abstract SparkSession in SparkPlanTest#55443
zhengruifeng wants to merge 1 commit into
apache:masterfrom
zhengruifeng:sql_spark_plan_test_abstract

Conversation

@zhengruifeng
Copy link
Copy Markdown
Contributor

@zhengruifeng zhengruifeng commented Apr 21, 2026

What changes were proposed in this pull request?

Remove the classic SparkSession override from SparkPlanTest, letting it inherit the abstract SparkSession from SparkSessionProvider. Also remove the now-unused classic import.

// Before
private[sql] abstract class SparkPlanTest extends SparkFunSuite with SparkSessionProvider {
  override protected def spark: classic.SparkSession
  ...
}

// After
private[sql] abstract class SparkPlanTest extends SparkFunSuite with SparkSessionProvider {
  ...
}

The existing import org.apache.spark.sql.classic.ClassicConversions._ handles implicit conversions to classic types where needed internally (e.g., when passing spark.sparkSession to new QueryExecution(...) which takes a classic SparkSession).

Why are the changes needed?

SparkPlanTest currently requires a classic.SparkSession, which tightly couples it to the classic implementation. Widening the type to the abstract SparkSession follows the same pattern as SPARK-56483 (SQLTestUtilsBase) — makes the test infrastructure more uniform and reduces direct references to the classic package in test utilities.

12 test suites extend SparkPlanTest and continue to work unchanged: SortSuite, ExchangeSuite, BroadcastExchangeSuite, ReuseExchangeAndSubquerySuite, TakeOrderedAndProjectSuite, BaseScriptTransformationSuite, InnerJoinSuite, OuterJoinSuite, ExistenceJoinSuite, SingleJoinSuite, BatchEvalPythonExecSuite, ExtractPythonUDFsSuite.

Does this PR introduce any user-facing change?

No. SparkPlanTest is private[sql].

How was this patch tested?

CI compilation across all modules.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code (claude-opus-4-6)

Remove the classic SparkSession override from SparkPlanTest, letting it
inherit the abstract SparkSession from SparkSessionProvider. Existing
ClassicConversions import handles conversions to classic types where
needed internally.

Co-authored-by: Isaac
@zhengruifeng
Copy link
Copy Markdown
Contributor Author

merged to master

@zhengruifeng zhengruifeng deleted the sql_spark_plan_test_abstract branch April 21, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants