This is an automated email from the ASF dual-hosted git repository.

github-merge-queue[bot] pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 343402d4115e test(spark): run other-2's SQL suites in parallel (#19932)
343402d4115e is described below

commit 343402d4115e1878b5b2b6a8583ab50ba53b5c6a
Author: voonhous <[email protected]>
AuthorDate: Wed Nov 25 09:24:19 2026 +0000

    test(spark): run other-2's SQL suites in parallel (#19932)
    
    * test(spark): run other-2's SQL suites in parallel
    
    scala-other-2 was the run's longest job at 35 to 37 minutes and
    the only Scala shard still serial, because its packages mix 33
    suites on HoodieSparkSqlTestBase (26.5 of its 28.4 minutes) with
    10 suites that build their own SparkContext (1.9 minutes).
    
    A ScalaTest tag annotation, SharedSessionSuite, marked @Inherited
    and placed on HoodieSparkSqlTestBase, now identifies the first
    group without listing suites: scala-other-2 runs the tagged suites
    in shared-session mode two at a time (-DtagsToInclude), and the
    untagged suites of the same packages run as a short extra step of
    test-spark-java17-ftb (-DtagsToExclude). A new suite lands on the
    serial side unless it extends the base.
    
    * test(spark): run the index lookup suites alone
    
    HoodieBackedTableMetadataIndexLookupTestBase unpersists every RDD
    of the SparkContext in its setup and teardown and asserts that the
    context holds none, so with a shared context a neighbouring
    suite's cached RDD fails "Should start with no persistent RDDs"
    (seen on the first two-thread run of the other-2 suites). The
    base now mixes in ExclusiveSuite, like TestSecondaryIndex and
    TestExpressionIndex, so its four short suites run alone.
    
    * test(spark): let CI override the scalatest exclude
    
    hudi-spark's pom pins tagsToExclude to the SparkSQLCoreFlow tag in
    the scalatest plugin configuration, and an explicit pom value wins
    over -DtagsToExclude, so the ftb step's exclusion of the shared
    session tag was silently ignored: it ran all 239 tests of the
    other-2 packages serially instead of the 88 own-context ones.
    
    The pom value moves to a property, hudi.scalatest.tagsToExclude,
    with the same default, and the ftb step passes the core-flow tag
    plus the shared-session tag through it.
    
    * test(spark): run the own-context Scala suites in the ftb invocation
    
    Instead of a second Maven invocation that repeats the reactor setup,
    the ftb step passes -DskipUTs=false, which overrides the
    functional-tests-b profile's skipUTs=true for the scalatest plugin
    only (surefire there reads skipFTs), together with the other-2
    wildcard filter and the tag exclusions. hudi-common drops out of
    -pl since it has no Scala suites.
---
 .github/workflows/bot.yml                          | 12 ++++---
 hudi-spark-datasource/hudi-spark/pom.xml           |  4 ++-
 .../spark/sql/hudi/common/SharedSessionSuite.java  | 41 ++++++++++++++++++++++
 .../sql/hudi/common/HoodieSparkSqlTestBase.scala   |  1 +
 .../TestHoodieBackedTableMetadataIndexLookup.scala |  3 ++
 5 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/bot.yml b/.github/workflows/bot.yml
index ce8f3a2514b9..6f02bb05d27d 100644
--- a/.github/workflows/bot.yml
+++ b/.github/workflows/bot.yml
@@ -1085,13 +1085,16 @@ jobs:
           SPARK_MODULES: ${{ matrix.sparkModules }}
         run:
           mvn clean install -T 2 -Pjava17 -D"$SCALA_PROFILE" 
-D"$SPARK_PROFILE" -DskipTests=true $MVN_ARGS -am -pl 
"hudi-common,$SPARK_COMMON_MODULES,$SPARK_MODULES"
-      - name: Java FTB - Spark
+      # -DskipUTs=false also runs the Scala suites of scala-other-2's packages 
that build their
+      # own SparkContext (about two minutes) in the same invocation. The 
shared-session suites of
+      # the same packages run in scala-other-2.
+      - name: Java FTB - Spark, Scala UT - remaining packages, own SparkContext
         env:
           SCALA_PROFILE: ${{ matrix.scalaProfile }}
           SPARK_PROFILE: ${{ matrix.sparkProfile }}
           SPARK_MODULES: ${{ matrix.sparkModules }}
         run:
-          mvn test -Pfunctional-tests-b -Pjava17 -D"$SCALA_PROFILE" 
-D"$SPARK_PROFILE" -pl "$SPARK_COMMON_MODULES,$SPARK_MODULES" $MVN_ARGS 
-Djacoco.skip=false
+          mvn test -Pfunctional-tests-b -Pjava17 -D"$SCALA_PROFILE" 
-D"$SPARK_PROFILE" -pl "$SPARK_COMMON_MODULES,$SPARK_MODULES" $MVN_ARGS 
-Djacoco.skip=false -DskipUTs=false $SCALA_TEST_OTHERS2_FILTER 
-Dhudi.scalatest.tagsToExclude=org.apache.hudi.functional.SparkSQLCoreFlow,org.apache.spark.sql.hudi.common.SharedSessionSuite
       - name: Test timing summary
         if: always()
         run: python3 scripts/ci/test_timing_summary.py --title "${{ github.job 
}}"
@@ -1339,6 +1342,7 @@ jobs:
           flags: spark-scala-tests
           token: ${{ secrets.CODECOV_TOKEN }}
 
+  # sharedSession + parallel: the HoodieSparkSqlTestBase suites of these 
packages (tag SharedSessionSuite) share one SparkContext and run two at a time; 
the other suites of the same packages run in test-spark-java17-ftb
   test-spark-java17-scala-other-2:
     if: *route
     needs: changes
@@ -1383,14 +1387,14 @@ jobs:
           SPARK_PROFILE: ${{ matrix.sparkProfile }}
           SPARK_MODULES: ${{ matrix.sparkModules }}
         run:
-          mvn test -Punit-tests -Pjava17 -D"$SCALA_PROFILE" -D"$SPARK_PROFILE" 
-Dtest=skipJavaTests $SCALA_TEST_OTHERS2_FILTER 
-Dsurefire.failIfNoSpecifiedTests=false -pl 
"hudi-common,$SPARK_COMMON_MODULES,$SPARK_MODULES" $MVN_ARGS -Djacoco.skip=false
+          mvn test -Punit-tests -Pjava17 -D"$SCALA_PROFILE" -D"$SPARK_PROFILE" 
-Dtest=skipJavaTests $SCALA_TEST_OTHERS2_FILTER 
-Dsurefire.failIfNoSpecifiedTests=false -pl 
"hudi-common,$SPARK_COMMON_MODULES,$SPARK_MODULES" $MVN_ARGS 
-Djacoco.skip=false -Dhudi.spark.test.sharedSession=true 
-Dhudi.scalatest.parallel=true -Dhudi.scalatest.threads=2 
-DtagsToInclude=org.apache.spark.sql.hudi.common.SharedSessionSuite
       - name: Scala FT - Spark (remaining packages)
         env:
           SCALA_PROFILE: ${{ matrix.scalaProfile }}
           SPARK_PROFILE: ${{ matrix.sparkProfile }}
           SPARK_MODULES: ${{ matrix.sparkModules }}
         run:
-          mvn test -Pfunctional-tests -Pjava17 -D"$SCALA_PROFILE" 
-D"$SPARK_PROFILE" -Dtest=skipJavaTests $SCALA_TEST_OTHERS2_FILTER 
-Dsurefire.failIfNoSpecifiedTests=false -pl 
"$SPARK_COMMON_MODULES,$SPARK_MODULES" $MVN_ARGS -Djacoco.skip=false
+          mvn test -Pfunctional-tests -Pjava17 -D"$SCALA_PROFILE" 
-D"$SPARK_PROFILE" -Dtest=skipJavaTests $SCALA_TEST_OTHERS2_FILTER 
-Dsurefire.failIfNoSpecifiedTests=false -pl 
"$SPARK_COMMON_MODULES,$SPARK_MODULES" $MVN_ARGS -Djacoco.skip=false 
-Dhudi.spark.test.sharedSession=true -Dhudi.scalatest.parallel=true 
-Dhudi.scalatest.threads=2 
-DtagsToInclude=org.apache.spark.sql.hudi.common.SharedSessionSuite
       - name: Test timing summary
         if: always()
         run: python3 scripts/ci/test_timing_summary.py --title "${{ github.job 
}}"
diff --git a/hudi-spark-datasource/hudi-spark/pom.xml 
b/hudi-spark-datasource/hudi-spark/pom.xml
index ca4a1fd4a29b..779e38ac229f 100644
--- a/hudi-spark-datasource/hudi-spark/pom.xml
+++ b/hudi-spark-datasource/hudi-spark/pom.xml
@@ -31,6 +31,8 @@
 
   <properties>
     <main.basedir>${project.parent.parent.basedir}</main.basedir>
+    <!-- ScalaTest tags excluded from this module's scalatest runs; CI 
overrides it with -Dhudi.scalatest.tagsToExclude -->
+    
<hudi.scalatest.tagsToExclude>org.apache.hudi.functional.SparkSQLCoreFlow</hudi.scalatest.tagsToExclude>
   </properties>
 
   <build>
@@ -116,7 +118,7 @@
         <groupId>org.scalatest</groupId>
         <artifactId>scalatest-maven-plugin</artifactId>
         <configuration>
-          
<tagsToExclude>org.apache.hudi.functional.SparkSQLCoreFlow</tagsToExclude>
+          <tagsToExclude>${hudi.scalatest.tagsToExclude}</tagsToExclude>
         </configuration>
       </plugin>
       <plugin>
diff --git 
a/hudi-spark-datasource/hudi-spark/src/test/java/org/apache/spark/sql/hudi/common/SharedSessionSuite.java
 
b/hudi-spark-datasource/hudi-spark/src/test/java/org/apache/spark/sql/hudi/common/SharedSessionSuite.java
new file mode 100644
index 000000000000..bd00e3f21b42
--- /dev/null
+++ 
b/hudi-spark-datasource/hudi-spark/src/test/java/org/apache/spark/sql/hudi/common/SharedSessionSuite.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.spark.sql.hudi.common;
+
+import org.scalatest.TagAnnotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * ScalaTest tag for suites that run on the JVM-wide shared SparkContext: 
every subclass of
+ * {@code HoodieSparkSqlTestBase}, through {@code @Inherited}. CI selects 
these suites with
+ * {@code -DtagsToInclude} on the shared-session shards and runs the rest with
+ * {@code -DtagsToExclude}, so a suite lands on the serial side unless it 
extends the base.
+ */
+@TagAnnotation
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface SharedSessionSuite {
+}
diff --git 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/common/HoodieSparkSqlTestBase.scala
 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/common/HoodieSparkSqlTestBase.scala
index 3ad84e0bc11b..2e62ef13a7e1 100644
--- 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/common/HoodieSparkSqlTestBase.scala
+++ 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/common/HoodieSparkSqlTestBase.scala
@@ -64,6 +64,7 @@ import java.util.regex.Pattern
 
 import scala.util.Try
 
+@SharedSessionSuite
 class HoodieSparkSqlTestBase extends FunSuite with BeforeAndAfterAll {
   org.apache.log4j.Logger.getRootLogger.setLevel(org.apache.log4j.Level.WARN)
   private val LOG = LoggerFactory.getLogger(getClass)
diff --git 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/feature/index/TestHoodieBackedTableMetadataIndexLookup.scala
 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/feature/index/TestHoodieBackedTableMetadataIndexLookup.scala
index adb13c10fa64..c88eaf193e0d 100644
--- 
a/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/feature/index/TestHoodieBackedTableMetadataIndexLookup.scala
+++ 
b/hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/feature/index/TestHoodieBackedTableMetadataIndexLookup.scala
@@ -44,6 +44,9 @@ import scala.collection.JavaConverters._
 /**
  * Base class for testing HoodieBackedTableMetadata index lookup functionality.
  * Provides shared setup and common test utilities.
+ *
+ * Runs alone (ExclusiveSuite): setup and teardown unpersist every RDD of the 
shared SparkContext and the
+ * tests assert the context holds none, which neighbouring suites would break.
  */
 abstract class HoodieBackedTableMetadataIndexLookupTestBase extends 
HoodieSparkSqlTestBase with ExclusiveSuite {
 

Reply via email to