This is an automated email from the ASF dual-hosted git repository.
feiwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 15844dc [KYUUBI #1056] [BUG] Log error if no current spark sql engine
is created.
15844dc is described below
commit 15844dc3739a34c462ff77c882a5da978c20a323
Author: Jagadesh Adireddi <[email protected]>
AuthorDate: Sat Nov 20 12:16:55 2021 +0800
[KYUUBI #1056] [BUG] Log error if no current spark sql engine is created.
Issue: https://github.com/apache/incubator-kyuubi/issues/1056
### _Why are the changes needed?_
Log an error message if no current spark sql engine is created.
### _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
- [x] [Run
test](https://kyuubi.readthedocs.io/en/latest/develop_tools/testing.html#running-tests)
locally before make a pull request
Closes #1423 from jadireddi/1056-no-currEng.
Closes #1056
a8d0443d [Jagadesh Adireddi] refactor
565d41a4 [Jagadesh Adireddi] [KYUUBI #1056] [BUG] Log error if no current
spark sql engine is created.
Authored-by: Jagadesh Adireddi <[email protected]>
Signed-off-by: fwang12 <[email protected]>
---
.../org/apache/kyuubi/engine/spark/SparkSQLEngine.scala | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala
index 57b4aa5..2c1f11f 100644
---
a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala
+++
b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala
@@ -158,12 +158,15 @@ object SparkSQLEngine extends Logging {
// blocking main thread
countDownLatch.await()
} catch {
- case e: KyuubiException if currentEngine.isDefined =>
- val engine = currentEngine.get
- engine.stop()
- val event = EngineEvent(engine).copy(diagnostic = e.getMessage)
- EventLoggingService.onEvent(event)
- error(event, e)
+ case e: KyuubiException => currentEngine match {
+ case Some(engine) =>
+ engine.stop()
+ val event = EngineEvent(engine).copy(diagnostic = e.getMessage)
+ EventLoggingService.onEvent(event)
+ error(event, e)
+ case _ => error("Current SparkSQLEngine is not created.")
+ }
+
}
} catch {
case t: Throwable => error(s"Failed to instantiate SparkSession:
${t.getMessage}", t)