You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by we...@apache.org on 2026/07/30 15:28:01 UTC

(spark) branch branch-4.x updated: [MINOR][SQL][TEST] Add catch-all case to non-total onOtherEvent in test listeners

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

cloud-fan pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.x by this push:
     new 2d47d9c00ab7 [MINOR][SQL][TEST] Add catch-all case to non-total onOtherEvent in test listeners
2d47d9c00ab7 is described below

commit 2d47d9c00ab7476b5b41b1b1df82b8608a4c52de
Author: haoyangeng-db <ha...@gmail.com>
AuthorDate: Thu Jul 30 23:27:17 2026 +0800

    [MINOR][SQL][TEST] Add catch-all case to non-total onOtherEvent in test listeners
    
    ### What changes were proposed in this pull request?
    
    Add a catch-all `case _ =>` as the final arm to a few SparkListener.onOtherEvent match blocks in test suites that enumerate only the specific event type(s) they care about and omit a catch-all: PluginContainerSuite, SQLExecutionSuite (jobTags / jobGroupId tests), and SparkConnectServiceInternalServerSuite.
    
    ### Why are the changes needed?
    
    SparkListenerBus.doPostEvent routes every non-built-in event to onOtherEvent, so a shared-queue listener receives all such events, not just the ones it enumerates. A match block with no `case _ =>` throws a scala.MatchError on every other event; ListenerBus.postToAll logs and swallows it, so tests pass but the logs are spammed with MatchError stack traces. The catch-all matches the convention the built-in listeners already follow and is always added last, so it never shadows an existi [...]
    
    ### How was this patch tested?
    
    This change is test-only.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Co-authored w/ Claude Code.
    
    Closes #57618 from haoyangeng-db/minor-sparklistener-onotherevent-catchall.
    
    Authored-by: haoyangeng-db <ha...@gmail.com>
    Signed-off-by: Wenchen Fan <we...@databricks.com>
    (cherry picked from commit 0caba769278ee7992f018151ad9a1ee091e32827)
    Signed-off-by: Wenchen Fan <we...@databricks.com>
---
 .../scala/org/apache/spark/internal/plugin/PluginContainerSuite.scala   | 1 +
 .../sql/connect/service/SparkConnectServiceInternalServerSuite.scala    | 1 +
 .../test/scala/org/apache/spark/sql/execution/SQLExecutionSuite.scala   | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/core/src/test/scala/org/apache/spark/internal/plugin/PluginContainerSuite.scala b/core/src/test/scala/org/apache/spark/internal/plugin/PluginContainerSuite.scala
index d87e5c024542..bc6a9ec21333 100644
--- a/core/src/test/scala/org/apache/spark/internal/plugin/PluginContainerSuite.scala
+++ b/core/src/test/scala/org/apache/spark/internal/plugin/PluginContainerSuite.scala
@@ -290,6 +290,7 @@ class PluginContainerSuite extends SparkFunSuite with LocalSparkContext {
           case _: TestSparkPluginEvent =>
             // Count down upon receiving the event sent from the plugin during shutdown.
             countDownLatch.countDown()
+          case _ =>
         }
       }
     })
diff --git a/sql/connect/server/src/test/scala/org/apache/spark/sql/connect/service/SparkConnectServiceInternalServerSuite.scala b/sql/connect/server/src/test/scala/org/apache/spark/sql/connect/service/SparkConnectServiceInternalServerSuite.scala
index 173dc5c672bc..eb52fdb8da64 100644
--- a/sql/connect/server/src/test/scala/org/apache/spark/sql/connect/service/SparkConnectServiceInternalServerSuite.scala
+++ b/sql/connect/server/src/test/scala/org/apache/spark/sql/connect/service/SparkConnectServiceInternalServerSuite.scala
@@ -302,6 +302,7 @@ private class SparkConnectServiceLifeCycleListener extends SparkListener {
         SparkConnectServiceLifeCycleListener.checksOnServiceEndEvent.foreach { checks =>
           checks.foreach(_(serviceEnd))
         }
+      case _ =>
     }
   }
 }
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLExecutionSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLExecutionSuite.scala
index 638d69fd7191..fc1d9099cbae 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLExecutionSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/SQLExecutionSuite.scala
@@ -351,6 +351,7 @@ class SQLExecutionSuite extends SparkFunSuite with SQLConfHelper {
           event match {
             case e: SparkListenerSQLExecutionStart =>
               sqlJobTags = e.jobTags
+            case _ =>
           }
         }
       })
@@ -383,6 +384,7 @@ class SQLExecutionSuite extends SparkFunSuite with SQLConfHelper {
           event match {
             case e: SparkListenerSQLExecutionStart =>
               sqlJobGroupIdOpt = e.jobGroupId
+            case _ =>
           }
         }
       })


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org