From 52464c25da220bb431a25123d1f6e6a5a15d14c8 Mon Sep 17 00:00:00 2001 From: Paul Lin Date: Sat, 20 May 2023 10:38:13 +0800 Subject: [PATCH] [KYUUBI #4861] Support Flink session idleness ### _Why are the changes needed?_ Support Flink session idleness. ### _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/master/develop_tools/testing.html#running-tests) locally before make a pull request Closes #4862 from link3280/KYUUBI-4861. Closes #4861 463d1bf9f [Paul Lin] [KYUUBI #4861] Fix class cast exception 882203157 [Paul Lin] [KYUUBI #4861] Improve code style 451403882 [Paul Lin] [KYUUBI #4861] Support Flink session idleness Authored-by: Paul Lin Signed-off-by: Cheng Pan --- .../engine/flink/session/FlinkSQLSessionManager.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/session/FlinkSQLSessionManager.scala b/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/session/FlinkSQLSessionManager.scala index 71caaa67a..c7aa7c3c5 100644 --- a/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/session/FlinkSQLSessionManager.scala +++ b/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/session/FlinkSQLSessionManager.scala @@ -70,6 +70,12 @@ class FlinkSQLSessionManager(engineContext: DefaultContext) } } + override def getSessionOption(sessionHandle: SessionHandle): Option[Session] = { + val session = super.getSessionOption(sessionHandle) + session.foreach(s => s.asInstanceOf[FlinkSessionImpl].fSession.touch()) + session + } + override def closeSession(sessionHandle: SessionHandle): Unit = { super.closeSession(sessionHandle) sessionManager.closeSession(