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

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


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

commit 0caba769278ee7992f018151ad9a1ee091e32827
Author: haoyangeng-db <[email protected]>
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 <[email protected]>
    Signed-off-by: Wenchen Fan <[email protected]>
---
 .../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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to