LuciferYang commented on code in PR #43745:
URL: https://github.com/apache/spark/pull/43745#discussion_r1389645364


##########
connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/client/SparkConnectClientSuite.scala:
##########
@@ -387,6 +387,33 @@ class SparkConnectClientSuite extends ConnectFunSuite with 
BeforeAndAfterEach {
     }
     assert(dummyFn.counter == 2)
   }
+
+  test("SPARK-45871: Client execute iterator.toSeq consumes the reattachable 
iterator") {

Review Comment:
   checked similar case in branch-3.5
   
   ```
     test("Client execute iterator.toSeq consumes the reattachable iterator") {
       startDummyServer(0)
       client = SparkConnectClient
         .builder()
         .connectionString(s"sc://localhost:${server.getPort}")
         .enableReattachableExecute()
         .build()
       val session = SparkSession.builder().client(client).create()
       val cmd = session.newCommand(b =>
         b.setSqlCommand(
           proto.SqlCommand
             .newBuilder()
             .setSql("select * from range(10000000)")))
       val plan = proto.Plan.newBuilder().setCommand(cmd)
       val iter = client.execute(plan.build())
       val reattachableIter = iter
         .asInstanceOf[WrappedCloseableIterator[proto.ExecutePlanResponse]]
         // ExecutePlanResponseReattachableIterator
         .innerIterator
         .asInstanceOf[ExecutePlanResponseReattachableIterator]
   
       iter.toSeq
       assert(reattachableIter.resultComplete)
     }
   ```
   the above test will failed in brach-3.5 as follows:
   
   ```
   [info] - Client execute iterator.toSeq consumes the reattachable iterator 
*** FAILED *** (70 milliseconds)
   [info]   reattachableIter.resultComplete was false 
(SparkConnectClientSuite.scala:383)
   [info]   org.scalatest.exceptions.TestFailedException:
   [info]   at 
org.scalatest.Assertions.newAssertionFailedException(Assertions.scala:472)
   [info]   at 
org.scalatest.Assertions.newAssertionFailedException$(Assertions.scala:471)
   [info]   at 
org.scalatest.Assertions$.newAssertionFailedException(Assertions.scala:1231)
   [info]   at 
org.scalatest.Assertions$AssertionsHelper.macroAssert(Assertions.scala:1295)
   [info]   at 
org.apache.spark.sql.connect.client.SparkConnectClientSuite.$anonfun$new$38(SparkConnectClientSuite.scala:383)
   ```
   



##########
connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/client/SparkConnectClientSuite.scala:
##########
@@ -387,6 +387,33 @@ class SparkConnectClientSuite extends ConnectFunSuite with 
BeforeAndAfterEach {
     }
     assert(dummyFn.counter == 2)
   }
+
+  test("SPARK-45871: Client execute iterator.toSeq consumes the reattachable 
iterator") {

Review Comment:
   checked similar case in branch-3.5
   
   ```scala
     test("Client execute iterator.toSeq consumes the reattachable iterator") {
       startDummyServer(0)
       client = SparkConnectClient
         .builder()
         .connectionString(s"sc://localhost:${server.getPort}")
         .enableReattachableExecute()
         .build()
       val session = SparkSession.builder().client(client).create()
       val cmd = session.newCommand(b =>
         b.setSqlCommand(
           proto.SqlCommand
             .newBuilder()
             .setSql("select * from range(10000000)")))
       val plan = proto.Plan.newBuilder().setCommand(cmd)
       val iter = client.execute(plan.build())
       val reattachableIter = iter
         .asInstanceOf[WrappedCloseableIterator[proto.ExecutePlanResponse]]
         // ExecutePlanResponseReattachableIterator
         .innerIterator
         .asInstanceOf[ExecutePlanResponseReattachableIterator]
   
       iter.toSeq
       assert(reattachableIter.resultComplete)
     }
   ```
   the above test will failed in brach-3.5 as follows:
   
   ```
   [info] - Client execute iterator.toSeq consumes the reattachable iterator 
*** FAILED *** (70 milliseconds)
   [info]   reattachableIter.resultComplete was false 
(SparkConnectClientSuite.scala:383)
   [info]   org.scalatest.exceptions.TestFailedException:
   [info]   at 
org.scalatest.Assertions.newAssertionFailedException(Assertions.scala:472)
   [info]   at 
org.scalatest.Assertions.newAssertionFailedException$(Assertions.scala:471)
   [info]   at 
org.scalatest.Assertions$.newAssertionFailedException(Assertions.scala:1231)
   [info]   at 
org.scalatest.Assertions$AssertionsHelper.macroAssert(Assertions.scala:1295)
   [info]   at 
org.apache.spark.sql.connect.client.SparkConnectClientSuite.$anonfun$new$38(SparkConnectClientSuite.scala:383)
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to