Skip to content

[GLUTEN-11550][UT] Replace GlutenTestsCommonTrait with correct Gluten test traits for Spark 4.0/4.1#11800

Open
baibaichen wants to merge 3 commits intoapache:mainfrom
baibaichen:fix/gluten-tests-common-trait-spark40-41
Open

[GLUTEN-11550][UT] Replace GlutenTestsCommonTrait with correct Gluten test traits for Spark 4.0/4.1#11800
baibaichen wants to merge 3 commits intoapache:mainfrom
baibaichen:fix/gluten-tests-common-trait-spark40-41

Conversation

@baibaichen
Copy link
Contributor

What changes were proposed in this pull request?

GlutenTestsCommonTrait does not configure GlutenPlugin or create a Gluten-enabled SparkSession. Test suites using this trait were running on vanilla Spark, falsely reporting "offload to gluten".

This PR replaces GlutenTestsCommonTrait with the correct traits in 157 test files (spark40 + spark41):

Category Count Target Trait Effect
SQL tests (QueryTest/SharedSparkSession) 105 GlutenSQLTestsTrait / GlutenSQLTestsBaseTrait SparkSession with GlutenPlugin via sparkConf override
Expression + Unit tests 73 GlutenTestsTrait (spark41: shim.GlutenTestsTrait) SparkSession with GlutenPlugin via initializeSession()
Hive tests (TestHiveSingleton) 7 Kept as GlutenTestsCommonTrait TestHive singleton cannot inject GlutenPlugin
BroadcastJoinSuite 1 Kept as GlutenTestsCommonTrait Already self-creates GlutenPlugin SparkSession

47 suites (spark41) / 42 suites (spark40) are disabled with // TODO: 4.x markers after failing under the correct traits. 25 of these are newly discovered failures; the rest were already tracked in #11550.

#11512 introduced PlanStability test suites for Spark 4.0 and 4.1 by extending Spark's original suites with GlutenTestsCommonTrait. While the tests appeared to pass, they were not actually loading the Gluten plugin — they were effectively running vanilla Spark, which trivially passes golden file comparison against Spark's own approved plans.

How was this patch tested?

  • Compiled both spark40 and spark41 (test-compile with mvnd)
  • Ran all 140+ enabled suites on spark41 via run-scala-test.sh --mvnd — all passed
  • Ran all 119+ enabled suites on spark40 — all passed
  • Ran the 40 spark41-excluded suites on spark40 to identify version-specific differences (5 suites pass on spark40 but fail on spark41)

New disabled suites discovered by this PR

These suites previously appeared to pass because they were not loading GlutenPlugin:

catalyst.expressions

Suite Spark 4.0 Spark 4.1
GlutenCastWithAnsiOnSuite 🔴 (4 failures) 🔴 (10 failures)
GlutenCollationRegexpExpressionsSuite 🟢 🔴 (1 failure)
GlutenExpressionEvalHelperSuite 🔴 (2 failures) 🔴 (2 failures)
GlutenObjectExpressionsSuite 🔴 (7 failures) 🔴 (7 failures)
GlutenOrderingSuite 🟢 🔴 (2 failures)
GlutenScalaUDFSuite 🔴 (1 failure) 🔴 (1 failure)
GlutenToPrettyStringSuite 🔴 (1 failure) 🔴 (1 failure)

execution

Suite Spark 4.0 Spark 4.1
GlutenCoalesceShufflePartitionsSuite 🔴 (ABORTED) 🔴 (ABORTED)
GlutenColumnarRulesSuite 🟢 🔴 (1 failure)
GlutenDataSourceScanExecRedactionSuite 🔴 (2 failures) 🔴 (2 failures)
GlutenDataSourceV2ScanExecRedactionSuite 🔴 (2 failures) 🔴 (2 failures)
GlutenExternalAppendOnlyUnsafeRowArraySuite 🔴 (14 failures) 🔴 (14 failures)
GlutenHiveResultSuite 🟢 🔴 (1 failure)
GlutenLogicalPlanTagInSparkPlanSuite 🔴 (ABORTED) 🔴 (ABORTED)
GlutenProjectedOrderingAndPartitioningSuite 🔴 (6 failures) 🔴 (6 failures)
GlutenRemoveRedundantProjectsSuite 🔴 (14 failures) 🔴 (14 failures)
GlutenSQLExecutionSuite 🔴 (1 failure) 🔴 (1 failure)
GlutenSQLJsonProtocolSuite 🔴 (1 failure) 🔴 (1 failure)
GlutenShufflePartitionsUtilSuite 🔴 (1 failure) 🔴 (1 failure)
GlutenSimpleSQLViewSuite 🔴 (1 failure) 🔴 (2 failures)
GlutenUnsafeRowSerializerSuite 🔴 (1 failure) 🔴 (1 failure)

execution.datasources.parquet

Suite Spark 4.0 Spark 4.1
GlutenParquetCommitterSuite 🔴 (spark.test.home) 🔴 (spark.test.home)

org.apache.spark.sql

Suite Spark 4.0 Spark 4.1
GlutenJoinHintSuite 🔴 (1 failure) 🔴 (1 failure)
GlutenRandomDataGeneratorSuite 🟢 🔴 (232 failures)

streaming

Suite Spark 4.0 Spark 4.1
GlutenTransformWithStateClusterSuite 🔴 (spark.test.home) 🔴 (spark.test.home)

@github-actions github-actions bot added the CORE works for Gluten Core label Mar 20, 2026
@baibaichen baibaichen force-pushed the fix/gluten-tests-common-trait-spark40-41 branch from e613866 to 70962e0 Compare March 20, 2026 09:16
baibaichen and others added 2 commits March 20, 2026 12:23
…SQLTestsBaseTrait for SQL tests

Replace GlutenTestsCommonTrait with the correct SQL test trait for 105 test suites
in spark40 and spark41 whose Spark parent classes extend QueryTest or
SharedSparkSession. This ensures these tests run with GlutenPlugin enabled.

- 80 suites -> GlutenSQLTestsTrait (with checkAnswer override)
- 25 suites -> GlutenSQLTestsBaseTrait (fallback for inheritance conflicts)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ssion and unit tests

Replace GlutenTestsCommonTrait with GlutenTestsTrait (shim.GlutenTestsTrait for
spark41) for 73 test suites whose Spark parent classes use ExpressionEvalHelper
or are pure SparkFunSuite. This ensures:

- Expression tests run checkEvaluation() through Gluten native engine
- Unit tests validate GlutenPlugin compatibility via a Gluten-enabled SparkSession

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@baibaichen baibaichen force-pushed the fix/gluten-tests-common-trait-spark40-41 branch 3 times, most recently from 2d0789f to 83008f4 Compare March 20, 2026 12:42
…enPlugin-enabled traits

These suites fail when running with GlutenPlugin loaded (via the new traits).
Failures include plan stability mismatches, spark.test.home requirements,
and Gluten-incompatible test assumptions. Commented out with TODO: 4.x markers
for future investigation.

Categories:
- 10 plan stability suites (golden file mismatch with Gluten execution plans)
- 3 spark.test.home required suites
- 27 other suites with various Gluten compatibility issues

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@baibaichen baibaichen force-pushed the fix/gluten-tests-common-trait-spark40-41 branch from 83008f4 to 8dd932b Compare March 20, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant