SteNicholas commented on a change in pull request #1921:
URL: https://github.com/apache/incubator-kyuubi/pull/1921#discussion_r809625834
##########
File path:
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/PlanOnlyStatement.scala
##########
@@ -38,23 +38,25 @@ class PlanOnlyStatement(
private val operationLog: OperationLog =
OperationLog.createOperationLog(session, getHandle)
override def getOperationLog: Option[OperationLog] = Option(operationLog)
- override protected def resultSchema: StructType =
- if (result == null) {
+ override protected def resultSchema: StructType = Option(result) match {
+ case Some(res) if res.isEmpty =>
+ new StructType().add("Result", "string")
+ case Some(res) =>
+ res.schema
+ case _ =>
new StructType().add("plan", "string")
- } else {
- result.schema
- }
+ }
- private def isSetOrReset(plan: LogicalPlan): Boolean = {
+ private def shouldDirectRun(plan: LogicalPlan): Boolean = {
val className = plan.getClass.getSimpleName
- className == "SetCommand" || className == "ResetCommand"
+ className == "SetCommand" || className == "ResetCommand" || className ==
"UseStatement"
Review comment:
> h migrate `UseStatement` to v2 command framework and change it to
`SetNamespaceCommand`, But Spark 3.1 and 3.2 still have `UseStatement`. Do our
changes here need to be forward compatible like Spark 3.3?
@iodone, IMO, for compatibility, you could check whether the Spark version
has the `UseStatement`. If no, use the `SetNamespaceCommand`.
--
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]