grundprinzip commented on code in PR #40160:
URL: https://github.com/apache/spark/pull/40160#discussion_r1119367129
##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectStreamHandler.scala:
##########
@@ -58,10 +59,49 @@ class SparkConnectStreamHandler(responseObserver:
StreamObserver[ExecutePlanResp
// Extract the plan from the request and convert it to a logical plan
val planner = new SparkConnectPlanner(session)
val dataframe = Dataset.ofRows(session,
planner.transformRelation(request.getPlan.getRoot))
- processAsArrowBatches(request.getClientId, dataframe)
+ processAsArrowBatches(request.getClientId, dataframe, responseObserver)
+ responseObserver.onNext(sendMetricsToResponse(request.getClientId,
dataframe))
+ responseObserver.onCompleted()
+ }
+
+ private def sendMetricsToResponse(clientId: String, rows: DataFrame):
ExecutePlanResponse = {
+ // Send a last batch with the metrics
+ ExecutePlanResponse
+ .newBuilder()
+ .setClientId(clientId)
+
.setMetrics(MetricGenerator.buildMetrics(rows.queryExecution.executedPlan))
+ .build()
+ }
+
+ private def handleCommand(session: SparkSession, request:
ExecutePlanRequest): Unit = {
+ val command = request.getPlan.getCommand
+ val planner = new SparkConnectPlanner(session)
+ planner.process(command, request.getClientId, responseObserver)
+ responseObserver.onCompleted()
Review Comment:
Added
--
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]