You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by GitBox <gi...@apache.org> on 2021/08/10 07:33:13 UTC

[GitHub] [incubator-kyuubi] yaooqinn commented on a change in pull request #914: Use isEmpty to trigger default init queries

yaooqinn commented on a change in pull request #914:
URL: https://github.com/apache/incubator-kyuubi/pull/914#discussion_r685765450



##########
File path: externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSQLSessionManager.scala
##########
@@ -53,20 +55,15 @@ class SparkSQLSessionManager private (name: String, spark: SparkSession)
     val sessionImpl = new SparkSessionImpl(protocol, user, password, ipAddress, conf, this)
     val handle = sessionImpl.handle
     try {
-      val sparkSession = if (this.conf.get(ENGINE_SINGLE_SPARK_SESSION)) {
+      val sparkSession = if (singleSparkSession) {
         spark
       } else {
-        spark.newSession()
-      }
-
-      if (!this.conf.get(ENGINE_SINGLE_SPARK_SESSION)) {
-        this.conf.get(ENGINE_SESSION_INITIALIZE_SQL)
-          .split(";")
-          .filter(_.trim.nonEmpty)
-          .foreach { sql =>
-            info(s"Execute session initializing sql: $sql")
-            sparkSession.sql(sql).show
-          }
+        val ss = spark.newSession()
+        this.conf.get(ENGINE_SESSION_INITIALIZE_SQL).foreach { sqlStr =>
+          ss.sparkContext.setJobGroup(handle.identifier.toString, sqlStr, interruptOnCancel = true)
+          ss.sql(sqlStr).isEmpty

Review comment:
       the UI is more straightforward




-- 
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: commits-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org