grundprinzip commented on code in PR #43664:
URL: https://github.com/apache/spark/pull/43664#discussion_r1383825497
##########
connector/connect/common/src/main/scala/org/apache/spark/sql/connect/client/CustomSparkConnectBlockingStub.scala:
##########
@@ -18,13 +18,93 @@ package org.apache.spark.sql.connect.client
import scala.jdk.CollectionConverters._
+import com.google.protobuf.GeneratedMessageV3
import io.grpc.ManagedChannel
+import io.grpc.stub.StreamObserver
import org.apache.spark.connect.proto._
+// This is common logic shared between the blocking and non-blocking stubs.
+//
+// The common logic is responsible to verify the integrity of the response.
The invariant is
+// that the same stub instance is used for all requests from the same client.
+private[client] class SparkConnectCommonStub {
+ // Server side session ID, used to detect if the server side session
changed. This is set upon
+ // receiving the first response from the server. This value is used only for
executions that
+ // do not use server-side streaming.
+ private var serverSideSessionId: Option[String] = None
Review Comment:
I moved it to shared state between the stubs
##########
connector/connect/common/src/main/scala/org/apache/spark/sql/connect/client/CustomSparkConnectBlockingStub.scala:
##########
@@ -18,13 +18,93 @@ package org.apache.spark.sql.connect.client
import scala.jdk.CollectionConverters._
+import com.google.protobuf.GeneratedMessageV3
import io.grpc.ManagedChannel
+import io.grpc.stub.StreamObserver
import org.apache.spark.connect.proto._
+// This is common logic shared between the blocking and non-blocking stubs.
+//
+// The common logic is responsible to verify the integrity of the response.
The invariant is
+// that the same stub instance is used for all requests from the same client.
+private[client] class SparkConnectCommonStub {
Review Comment:
Refactored
--
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]