[KYUUBI #3711] PlanOnly should output engine logs to log files

### _Why are the changes needed?_

Fix https://github.com/apache/incubator-kyuubi/issues/3711
PlanOnly should output engine logs to log files so that they can be pulled from the front end.

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #3712 from Yikf/planOnly-log-out.

Closes #3711

8469de9a [Yikf] planOnly should output engine logs to log files so that they can be pulled from the front end

Authored-by: Yikf <yikaifei1@gmail.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
Yikf 2022-10-29 10:41:37 +00:00 committed by Cheng Pan
parent bea8e4f1cb
commit b8b9a2123d
2 changed files with 10 additions and 0 deletions

View File

@ -38,6 +38,11 @@ class PlanOnlyStatement(
private val lineSeparator: String = System.lineSeparator()
override def getOperationLog: Option[OperationLog] = Option(operationLog)
override protected def beforeRun(): Unit = {
OperationLog.setCurrentOperationLog(operationLog)
super.beforeRun()
}
override protected def runInternal(): Unit = {
try {
val operation = executor.parseStatement(sessionId, statement)

View File

@ -60,6 +60,11 @@ class PlanOnlyStatement(
} else result.schema
}
override protected def beforeRun(): Unit = {
OperationLog.setCurrentOperationLog(operationLog)
super.beforeRun()
}
override protected def runInternal(): Unit = withLocalProperties {
try {
SQLConf.withExistingConf(spark.sessionState.conf) {