pan3793 commented on a change in pull request #857:
URL: https://github.com/apache/incubator-kyuubi/pull/857#discussion_r677536563



##########
File path: 
kyuubi-main/src/test/scala/org/apache/kyuubi/engine/spark/InitializeSQLSuite.scala
##########
@@ -40,12 +45,31 @@ class InitializeSQLSuite extends WithKyuubiServer with 
JDBCTestUtils {
 
   test("KYUUBI-457: Support configurable initialize sql statement for engine 
startup") {
     withJdbcStatement() { statement =>
-      val result = statement.executeQuery("SELECT * FROM INIT_DB.test")
+      val result = statement.executeQuery("SELECT * FROM INIT_DB.test WHERE a 
= 1")
       assert(result.next())
       assert(result.getInt(1) == 1)
       assert(!result.next())
     }
   }
 
+  test("Support configurable initialize sql statement for engine session 
creation") {
+    var currentSessionCnt: Long = -1
+    withJdbcStatement() { statement =>
+      val result = statement.executeQuery("SELECT COUNT(*) FROM INIT_DB.test 
WHERE a = 2")
+      assert(result.next())
+      currentSessionCnt = result.getLong(1)
+      assert(currentSessionCnt >= 1)
+      assert(!result.next())
+    }
+    // new session
+    withJdbcStatement() { statement =>
+      val result = statement.executeQuery("SELECT COUNT(*) FROM INIT_DB.test 
WHERE a = 2")
+      assert(result.next())
+      // use great than or equals to support concurrent test
+      assert(result.getLong(1) >= currentSessionCnt + 1)
+      assert(!result.next())
+    }

Review comment:
       yes, will update




-- 
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]


Reply via email to