dongjoon-hyun commented on code in PR #53156:
URL: https://github.com/apache/spark/pull/53156#discussion_r2550951929
##########
sql/connect/server/src/test/scala/org/apache/spark/sql/connect/pipelines/SparkDeclarativePipelinesServerSuite.scala:
##########
@@ -850,4 +850,98 @@ class SparkDeclarativePipelinesServerSuite
}
}
}
+
+ test(
+ "SPARK-54452: spark.sql() inside a pipeline flow function should return a
sql_command_result") {
+ withRawBlockingStub { implicit stub =>
+ val graphId = createDataflowGraph
+ val pipelineAnalysisContext = proto.PipelineAnalysisContext
+ .newBuilder()
+ .setDataflowGraphId(graphId)
+ .setFlowName("flow1")
+ .build()
+ val userContext = proto.UserContext
+ .newBuilder()
+ .addExtensions(com.google.protobuf.Any.pack(pipelineAnalysisContext))
+ .setUserId("test_user")
+ .build()
+
+ val relation = proto.Plan
+ .newBuilder()
+ .setCommand(
+ proto.Command
+ .newBuilder()
+ .setSqlCommand(
+ proto.SqlCommand
+ .newBuilder()
+ .setInput(
+ proto.Relation
+ .newBuilder()
+ .setRead(proto.Read
+ .newBuilder()
+ .setNamedTable(
+
proto.Read.NamedTable.newBuilder().setUnparsedIdentifier("table"))
+ .build())
+ .build()))
+ .build())
+ .build()
+
+ val sparkSqlRequest = proto.ExecutePlanRequest
+ .newBuilder()
+ .setUserContext(userContext)
+ .setPlan(relation)
+ .setSessionId(UUID.randomUUID().toString)
+ .build()
+ val sparkSqlResponse = stub.executePlan(sparkSqlRequest).next()
+ assert(sparkSqlResponse.hasSqlCommandResult)
+ assert(
+ sparkSqlResponse.getSqlCommandResult.getRelation ==
+ relation.getCommand.getSqlCommand.getInput)
+ }
+ }
+
+ test(
+ "SPARK-54452: spark.sql() outside a pipeline flow function should return a
" +
+ "sql_command_result") {
Review Comment:
Why do we expect the same behavior? According to the log, it is guarded by
`insidePipelineFlowFunction` condition, isn't it?
https://github.com/apache/spark/blob/da7389bb81ab9756c70a5aa168c5128632c3b31e/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala#L2993-L2996
--
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]