[SPARK-56563][SQL][TESTS] Merge SparkPlanTest into QueryTest/QueryTestBase#55472
Closed
zhengruifeng wants to merge 1 commit into
Closed
[SPARK-56563][SQL][TESTS] Merge SparkPlanTest into QueryTest/QueryTestBase#55472zhengruifeng wants to merge 1 commit into
zhengruifeng wants to merge 1 commit into
Conversation
…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
HyukjinKwon
approved these changes
Apr 22, 2026
cloud-fan
approved these changes
Apr 22, 2026
Member
|
Merged to master. |
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?
Followup to SPARK-55910 / SPARK-56560. Merge the helper methods from
SparkPlanTest(inorg.apache.spark.sql.execution) intoQueryTest/QueryTestBase(inorg.apache.spark.sql), and reduceSparkPlanTestto a thin deprecated alias for backward compatibility.Moved into
trait QueryTestBase(non-anyfun instance helpers — notest(...)dependency, so they don't need theAnyFunSuitemixin thatQueryTestadds):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)SparkPlanTestbecomes:@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 ofSparkPlanTest.{checkAnswer, executePlan}(inBaseScriptTransformationSuite,SingleJoinSuite,HiveScriptTransformationSuite) keep working unchanged via the deprecated aliases.Also dropped the
= NUM_VALUESdefault on the privateParquetVectorizedSuite.checkAnswerto avoid the Scala "multiple overloaded alternatives ... define default arguments" error against the newQueryTestBase.checkAnswer(both call sites already passbatchSizeexplicitly, 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 extendQueryTestdirectly instead of having to pick betweenQueryTestandSparkPlanTest.Does this PR introduce any user-facing change?
No, test-only.
How was this patch tested?
Locally compiled
sql/Test/compileandhive/Test/compile. RanSortSuite(255 tests),ParquetVectorizedSuite(25 tests), andSingleJoinSuite(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