zhengruifeng commented on code in PR #38468:
URL: https://github.com/apache/spark/pull/38468#discussion_r1013550540
##########
connector/connect/src/main/scala/org/apache/spark/sql/connect/service/SparkConnectStreamHandler.scala:
##########
@@ -117,7 +131,36 @@ class SparkConnectStreamHandler(responseObserver:
StreamObserver[Response]) exte
responseObserver.onNext(response.build())
}
- responseObserver.onNext(sendMetricsToResponse(clientId, rows))
+ responseObserver.onNext(sendMetricsToResponse(clientId, dataframe))
+ responseObserver.onCompleted()
+ }
+
+ def processRowsAsArrowBatches(clientId: String, dataframe: DataFrame): Unit
= {
+ val schema = dataframe.schema
+ val maxRecordsPerBatch =
dataframe.sparkSession.sessionState.conf.arrowMaxRecordsPerBatch
+ val timeZoneId =
dataframe.sparkSession.sessionState.conf.sessionLocalTimeZone
+
+ val batches = dataframe.queryExecution.executedPlan
+ .execute()
+ .mapPartitionsInternal { iter =>
+ ArrowConverters
+ .toArrowBatchIterator(iter, schema, maxRecordsPerBatch, timeZoneId,
TaskContext.get)
+ }
+
+ batches.toLocalIterator.foreach { case (bytes, count, size) =>
Review Comment:
maybe we should also add a field `partitionId` in proto message, than we
sort by it in client to keep the order
--
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]