hvanhovell commented on code in PR #40160:
URL: https://github.com/apache/spark/pull/40160#discussion_r1118936286
##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -1450,10 +1457,27 @@ class SparkConnectPlanner(val session: SparkSession) {
handleWriteOperationV2(command.getWriteOperationV2)
case proto.Command.CommandTypeCase.EXTENSION =>
handleCommandPlugin(command.getExtension)
+ case proto.Command.CommandTypeCase.SQL_COMMAND =>
+ handleSqlCommand(command.getSqlCommand, clientId, responseObserver)
case _ => throw new UnsupportedOperationException(s"$command not
supported.")
}
}
+ def handleSqlCommand(
+ getSqlCommand: SqlCommand,
+ clientId: String,
+ responseObserver: StreamObserver[ExecutePlanResponse]): Unit = {
+ val df = session.sql(getSqlCommand.getSql, getSqlCommand.getArgsMap)
+ val isCommand =
df.queryExecution.commandExecuted.isInstanceOf[CommandResult]
+ responseObserver.onNext(
+ ExecutePlanResponse
+ .newBuilder()
+ .setClientId(clientId)
+
.setSqlCommandResult(SqlCommandResult.newBuilder().setIsCommand(isCommand))
+ .build())
+ SparkConnectStreamHandler.processAsArrowBatches(clientId, df,
responseObserver)
Review Comment:
Does this always execute the query? I thought we only execute commands?
--
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]