You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@livy.apache.org by js...@apache.org on 2019/09/04 03:09:31 UTC

[incubator-livy] branch master updated: [LIVY-652] Thrifserver doesn't set session name correctly

This is an automated email from the ASF dual-hosted git repository.

jshao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-livy.git


The following commit(s) were added to refs/heads/master by this push:
     new e6b6ec0  [LIVY-652] Thrifserver doesn't set session name correctly
e6b6ec0 is described below

commit e6b6ec060d18d33a300ffa7d766ad46d6c4c70cf
Author: Jeffrey(Xilang) Yan <78...@users.noreply.github.com>
AuthorDate: Wed Sep 4 11:08:58 2019 +0800

    [LIVY-652] Thrifserver doesn't set session name correctly
    
    ## What changes were proposed in this pull request?
    
    Thriftserver should set session name as the value passed in livy.session.name , but it current always set it NONE
    
    ## How was this patch tested?
    
    add IT
    
    https://issues.apache.org/jira/browse/LIVY-652
    
    Author: Jeffrey(Xilang) Yan <78...@users.noreply.github.com>
    
    Closes #218 from yantzu/thrift_session_has_no_name.
---
 .../livy/thriftserver/LivyThriftSessionManager.scala    |  2 +-
 .../apache/livy/thriftserver/ThriftServerSuites.scala   | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/thriftserver/server/src/main/scala/org/apache/livy/thriftserver/LivyThriftSessionManager.scala b/thriftserver/server/src/main/scala/org/apache/livy/thriftserver/LivyThriftSessionManager.scala
index bc62084..67c8265 100644
--- a/thriftserver/server/src/main/scala/org/apache/livy/thriftserver/LivyThriftSessionManager.scala
+++ b/thriftserver/server/src/main/scala/org/apache/livy/thriftserver/LivyThriftSessionManager.scala
@@ -228,7 +228,7 @@ class LivyThriftSessionManager(val server: LivyThriftServer, val livyConf: LivyC
       createInteractiveRequest.kind = Spark
       val newSession = InteractiveSession.create(
         server.livySessionManager.nextId(),
-        None,
+        createInteractiveRequest.name,
         username,
         None,
         server.livyConf,
diff --git a/thriftserver/server/src/test/scala/org/apache/livy/thriftserver/ThriftServerSuites.scala b/thriftserver/server/src/test/scala/org/apache/livy/thriftserver/ThriftServerSuites.scala
index 438d86c..48750da 100644
--- a/thriftserver/server/src/test/scala/org/apache/livy/thriftserver/ThriftServerSuites.scala
+++ b/thriftserver/server/src/test/scala/org/apache/livy/thriftserver/ThriftServerSuites.scala
@@ -396,6 +396,23 @@ class BinaryThriftServerSuite extends ThriftServerBaseTest with CommonThriftTest
       getTypeInfoTest(c)
     }
   }
+
+  test("LIVY-652: should set session name correctly") {
+    val livySessionManager = LivyThriftServer.getInstance.get.livySessionManager
+    val testSessionName = "MySessionName"
+    assert(livySessionManager.get(testSessionName).isEmpty)
+    withJdbcConnection("default", Seq(s"livy.session.name=${testSessionName}")) { c =>
+      // execute a statement and block until session is ready
+      val statement = c.createStatement()
+      try {
+        statement.executeQuery("select current_database()")
+      } finally {
+        statement.close()
+      }
+
+      assert(livySessionManager.get(testSessionName).get.name.get == testSessionName)
+    }
+  }
 }
 
 class HttpThriftServerSuite extends ThriftServerBaseTest with CommonThriftTests {