Skip to content

[SPARK-56563][SQL][TESTS] Merge SparkPlanTest into QueryTest/QueryTestBase#55472

Closed
zhengruifeng wants to merge 1 commit into
apache:masterfrom
zhengruifeng:merge-sparkplantest-into-querytest
Closed

[SPARK-56563][SQL][TESTS] Merge SparkPlanTest into QueryTest/QueryTestBase#55472
zhengruifeng wants to merge 1 commit into
apache:masterfrom
zhengruifeng:merge-sparkplantest-into-querytest

Conversation

@zhengruifeng
Copy link
Copy Markdown
Contributor

@zhengruifeng zhengruifeng commented Apr 22, 2026

What changes were proposed in this pull request?

Followup to SPARK-55910 / SPARK-56560. Merge the helper methods from SparkPlanTest (in org.apache.spark.sql.execution) into QueryTest/QueryTestBase (in org.apache.spark.sql), and reduce SparkPlanTest to a thin deprecated alias for backward compatibility.

Moved into trait QueryTestBase (non-anyfun instance helpers — no test(...) dependency, so they don't need the AnyFunSuite mixin that QueryTest adds):

  • checkAnswer(DataFrame, SparkPlan => SparkPlan, Seq[Row], Boolean)
  • checkAnswer2(DataFrame, DataFrame, (SparkPlan, SparkPlan) => SparkPlan, Seq[Row], Boolean)
  • doCheckAnswer(Seq[DataFrame], Seq[SparkPlan] => SparkPlan, Seq[Row], Boolean)
  • checkThatPlansAgree(DataFrame, SparkPlan => SparkPlan, SparkPlan => SparkPlan, Boolean)

Moved into object QueryTest (static helpers):

  • checkAnswer(DataFrame, SparkPlan => SparkPlan, SparkPlan => SparkPlan, Boolean, SQLContext)
  • checkAnswer(Seq[DataFrame], Seq[SparkPlan] => SparkPlan, Seq[Row], Boolean, SQLContext)
  • executePlan(SparkPlan, SQLContext)

SparkPlanTest becomes:

  • @deprecated private[sql] trait SparkPlanTest extends QueryTest
  • @deprecated private[sql] object SparkPlanTest { /* thin delegates to QueryTest */ }

Existing subclasses (SortSuite, ExchangeSuite, BroadcastExchangeSuite, InnerJoinSuite, OuterJoinSuite, ExistenceJoinSuite, SingleJoinSuite, TakeOrderedAndProjectSuite, ReuseExchangeAndSubquerySuite, BatchEvalPythonExecSuite, ExtractPythonUDFsSuite, BaseScriptTransformationSuite) and call sites of SparkPlanTest.{checkAnswer, executePlan} (in BaseScriptTransformationSuite, SingleJoinSuite, HiveScriptTransformationSuite) keep working unchanged via the deprecated aliases.

Also dropped the = NUM_VALUES default on the private ParquetVectorizedSuite.checkAnswer to avoid the Scala "multiple overloaded alternatives ... define default arguments" error against the new QueryTestBase.checkAnswer (both call sites already pass batchSize explicitly, so behavior is unchanged).

Why are the changes needed?

Consolidates the test-helper surface into QueryTest/QueryTestBase, matching the direction of SPARK-55910/SPARK-56560. New test suites can extend QueryTest directly instead of having to pick between QueryTest and SparkPlanTest.

Does this PR introduce any user-facing change?

No, test-only.

How was this patch tested?

Locally compiled sql/Test/compile and hive/Test/compile. Ran SortSuite (255 tests), ParquetVectorizedSuite (25 tests), and SingleJoinSuite (36 tests) — all pass. Relying on CI for full test run.

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

Generated-by: Claude Opus 4.7

…tBase

### What changes were proposed in this pull request?

Followup to SPARK-55910 / SPARK-56560. Merge the helper methods from
`SparkPlanTest` (in `org.apache.spark.sql.execution`) into
`QueryTest`/`QueryTestBase` (in `org.apache.spark.sql`), and reduce
`SparkPlanTest` to a thin deprecated alias for backward compatibility.

Moved to `trait QueryTestBase` (non-anyfun instance helpers):
- `checkAnswer(DataFrame, SparkPlan => SparkPlan, Seq[Row], Boolean)`
- `checkAnswer2(DataFrame, DataFrame, (SparkPlan, SparkPlan) => SparkPlan, Seq[Row], Boolean)`
- `doCheckAnswer(Seq[DataFrame], Seq[SparkPlan] => SparkPlan, Seq[Row], Boolean)`
- `checkThatPlansAgree(DataFrame, SparkPlan => SparkPlan, SparkPlan => SparkPlan, Boolean)`

Moved to `object QueryTest` (static helpers):
- `checkAnswer(DataFrame, SparkPlan => SparkPlan, SparkPlan => SparkPlan, Boolean, SQLContext)`
- `checkAnswer(Seq[DataFrame], Seq[SparkPlan] => SparkPlan, Seq[Row], Boolean, SQLContext)`
- `executePlan(SparkPlan, SQLContext)`

`SparkPlanTest` becomes:
- `@deprecated private[sql] trait SparkPlanTest extends QueryTest`
- `@deprecated private[sql] object SparkPlanTest { /* thin delegates to QueryTest */ }`

Also removed the `= NUM_VALUES` default from the private
`ParquetVectorizedSuite.checkAnswer` to resolve a Scala
overload-with-default ambiguity against the new `QueryTestBase.checkAnswer`
(both call sites already pass `batchSize` explicitly, so behavior is
unchanged).

### Why are the changes needed?

Consolidates the test-helper surface into `QueryTest`/`QueryTestBase`,
matching the direction of SPARK-55910/SPARK-56560. New test suites can
extend `QueryTest` directly; existing `SparkPlanTest` subclasses and
callers of `SparkPlanTest.{checkAnswer, executePlan}` keep working via
the deprecated alias.

### Does this PR introduce _any_ user-facing change?

No, test-only.

### How was this patch tested?

Locally compiled `sql/Test/compile` and `hive/Test/compile`. Ran
`SortSuite` (255 tests), `ParquetVectorizedSuite` (25 tests), and
`SingleJoinSuite` (36 tests) — all pass.

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

Generated-by: Claude Opus 4.7
@zhengruifeng zhengruifeng requested a review from cloud-fan April 22, 2026 05:26
@HyukjinKwon
Copy link
Copy Markdown
Member

Merged to master.

@zhengruifeng zhengruifeng deleted the merge-sparkplantest-into-querytest branch April 22, 2026 23:49
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.

3 participants