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

gurwls223 pushed a commit to branch branch-3.5
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.5 by this push:
     new 45349b652e2d [SPARK-50510][CONNECT][TEST][3.5] Fix flaky 
ReattachableExecuteSuite
45349b652e2d is described below

commit 45349b652e2d6c24b4f5eef1f6118389c0d68ed8
Author: changgyoopark-db <[email protected]>
AuthorDate: Tue Dec 17 20:12:22 2024 +0900

    [SPARK-50510][CONNECT][TEST][3.5] Fix flaky ReattachableExecuteSuite
    
    ### What changes were proposed in this pull request?
    
    Simplify 
org.apache.spark.sql.connect.execution.ReattachableExecuteSuite."reattach after 
connection expired" to make it more deterministic.
    
    ### Why are the changes needed?
    
    The test previously involved execution and interruption that made the test 
unnecessarily flaky, e.g., an exception was thrown when releasing the 
corresponding 
[execution](https://github.com/apache/spark/actions/runs/12296721038/job/34316344940),
 not when reattaching the execution.
    - The test's sole purpose is to check whether the lack of 'session' results 
in the correct error code.
    - The involvement of actual query execution only makes the test flaky and 
complicated.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Repeatedly ran testOnly 
org.apache.spark.sql.connect.execution.ReattachableExecuteSuite.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #49203 from changgyoopark-db/SPARK-50510.
    
    Authored-by: changgyoopark-db <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 .../sql/connect/execution/ReattachableExecuteSuite.scala  | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git 
a/connector/connect/server/src/test/scala/org/apache/spark/sql/connect/execution/ReattachableExecuteSuite.scala
 
b/connector/connect/server/src/test/scala/org/apache/spark/sql/connect/execution/ReattachableExecuteSuite.scala
index f828e45e6a6c..00de9fb6fd26 100644
--- 
a/connector/connect/server/src/test/scala/org/apache/spark/sql/connect/execution/ReattachableExecuteSuite.scala
+++ 
b/connector/connect/server/src/test/scala/org/apache/spark/sql/connect/execution/ReattachableExecuteSuite.scala
@@ -58,18 +58,15 @@ class ReattachableExecuteSuite extends 
SparkConnectServerTest {
 
   test("reattach after connection expired") {
     withClient { client =>
-      val iter = client.execute(buildPlan(MEDIUM_RESULTS_QUERY))
-      val operationId = getReattachableIterator(iter).operationId
-      // open the iterator
-      iter.next()
-
-      SparkConnectService.invalidateSession(defaultUserId, defaultSessionId)
       withRawBlockingStub { stub =>
-        val iter2 = 
stub.reattachExecute(buildReattachExecuteRequest(operationId, None))
+        // emulate session expiration
+        SparkConnectService.invalidateSession(defaultUserId, defaultSessionId)
 
-        // session closed, bound to fail
+        // session closed, bound to fail immediately
+        val operationId = UUID.randomUUID().toString
+        val iter = 
stub.reattachExecute(buildReattachExecuteRequest(operationId, None))
         val e = intercept[StatusRuntimeException] {
-          while (iter2.hasNext) iter2.next()
+          iter.next()
         }
         assert(e.getMessage.contains("INVALID_HANDLE.SESSION_NOT_FOUND"))
       }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to