From ca9bd5361b60f266c003c01ec34431bfb0420385 Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Tue, 26 Sep 2023 14:17:40 +0800 Subject: [PATCH] [JDBC] Adaptive call fetchLaunchEngineResult --- .../org/apache/kyuubi/config/KyuubiReservedKeys.scala | 2 ++ .../java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java | 7 ++++++- .../kyuubi/server/KyuubiTBinaryFrontendService.scala | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiReservedKeys.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiReservedKeys.scala index 8b42e659f82..eb209caec99 100644 --- a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiReservedKeys.scala +++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiReservedKeys.scala @@ -38,6 +38,8 @@ object KyuubiReservedKeys { "kyuubi.session.engine.launch.handle.guid" final val KYUUBI_SESSION_ENGINE_LAUNCH_HANDLE_SECRET = "kyuubi.session.engine.launch.handle.secret" + final val KYUUBI_SESSION_ENGINE_LAUNCH_SUPPORT_RESULT = + "kyuubi.session.engine.launch.support.result" final val KYUUBI_OPERATION_SET_CURRENT_CATALOG = "kyuubi.operation.set.current.catalog" final val KYUUBI_OPERATION_GET_CURRENT_CATALOG = "kyuubi.operation.get.current.catalog" final val KYUUBI_OPERATION_SET_CURRENT_DATABASE = "kyuubi.operation.set.current.database" diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java index f9935d23e19..c23985328ec 100644 --- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java +++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java @@ -104,6 +104,7 @@ public class KyuubiConnection implements SQLConnection, KyuubiLoggable { private Thread engineLogThread; private boolean engineLogInflight = true; private volatile boolean launchEngineOpCompleted = false; + private boolean launchEngineOpSupportResult = false; private String engineId = ""; private String engineName = ""; private String engineUrl = ""; @@ -770,6 +771,10 @@ private void openSession() throws SQLException { String launchEngineOpHandleSecret = openRespConf.get("kyuubi.session.engine.launch.handle.secret"); + launchEngineOpSupportResult = + Boolean.parseBoolean( + openRespConf.getOrDefault("kyuubi.session.engine.launch.support.result", "false")); + if (launchEngineOpHandleGuid != null && launchEngineOpHandleSecret != null) { try { byte[] guidBytes = Base64.getMimeDecoder().decode(launchEngineOpHandleGuid); @@ -1353,7 +1358,7 @@ public void waitLaunchEngineToComplete() throws SQLException { } private void fetchLaunchEngineResult() { - if (launchEngineOpHandle == null) return; + if (launchEngineOpHandle == null || !launchEngineOpSupportResult) return; TFetchResultsReq tFetchResultsReq = new TFetchResultsReq( diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala index 069bc63e2b0..ae388a7c42a 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala @@ -92,6 +92,8 @@ final class KyuubiTBinaryFrontendService( KYUUBI_SESSION_ENGINE_LAUNCH_HANDLE_SECRET, Base64.getMimeEncoder.encodeToString(opHandleIdentifier.getSecret)) + respConfiguration.put(KYUUBI_SESSION_ENGINE_LAUNCH_SUPPORT_RESULT, true.toString) + resp.setSessionHandle(sessionHandle.toTSessionHandle) resp.setConfiguration(respConfiguration) resp.setStatus(OK_STATUS)