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

chengpan pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.9 by this push:
     new 44e874400 [KYUUBI #6549] Correctly handle empty Java options for 
engines
44e874400 is described below

commit 44e8744009225c7363ac2d0b858e6584b54801ad
Author: lijie0203 <[email protected]>
AuthorDate: Mon Aug 5 15:47:35 2024 +0800

    [KYUUBI #6549] Correctly handle empty Java options for engines
    
    [KYUUBI #6549] Fix 'Could not find or load main class when launching engine'
    
    This pull request fixes #6549
    
    When obtaining configuration items, if it is null or empty, return none
    
    - [ ] Bugfix (non-breaking change which fixes an issue)
    - [ ] New feature (non-breaking change which adds functionality)
    - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
    
    ---
    
    - [ ] This patch was not authored or co-authored using [Generative 
Tooling](https://www.apache.org/legal/generative-tooling.html)
    
    **Be nice. Be informative.**
    
    Closes #6556 from LiJie20190102/launch_engine.
    
    Closes #6549
    
    c57a08aff [lijie0203] [KYUUBI #6549] Fix 'Could not find or load main class 
when launching engine'
    642d807e2 [lijie0203] [KYUUBI #6549] Fix 'Could not find or load main class 
when launching engine'
    67926094c [lijie0203] [KYUUBI #6549] Fix 'Could not find or load main class 
when launching engine'
    4ba9fb587 [lijie0203] [KYUUBI #6549] Fix 'Could not find or load main class 
when launching engine'
    
    Authored-by: lijie0203 <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit edff97d3e9aa586184eb3b77e23eb104515d03d7)
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../org/apache/kyuubi/engine/flink/WithFlinkSQLEngineLocal.scala      | 3 ++-
 .../apache/kyuubi/engine/deploy/yarn/EngineYarnModeSubmitter.scala    | 4 +++-
 .../main/scala/org/apache/kyuubi/engine/chat/ChatProcessBuilder.scala | 3 ++-
 .../scala/org/apache/kyuubi/engine/flink/FlinkProcessBuilder.scala    | 3 ++-
 .../main/scala/org/apache/kyuubi/engine/hive/HiveProcessBuilder.scala | 3 ++-
 .../main/scala/org/apache/kyuubi/engine/jdbc/JdbcProcessBuilder.scala | 3 ++-
 .../scala/org/apache/kyuubi/engine/trino/TrinoProcessBuilder.scala    | 3 ++-
 7 files changed, 15 insertions(+), 7 deletions(-)

diff --git 
a/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/WithFlinkSQLEngineLocal.scala
 
b/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/WithFlinkSQLEngineLocal.scala
index c85c18fd4..4ae7983a9 100644
--- 
a/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/WithFlinkSQLEngineLocal.scala
+++ 
b/externals/kyuubi-flink-sql-engine/src/test/scala/org/apache/kyuubi/engine/flink/WithFlinkSQLEngineLocal.scala
@@ -25,6 +25,7 @@ import java.nio.file.{Files, Paths}
 import scala.collection.JavaConverters._
 import scala.collection.mutable
 
+import org.apache.commons.lang3.StringUtils
 import org.apache.flink.configuration.{Configuration, RestOptions}
 import org.apache.flink.runtime.minicluster.{MiniCluster, 
MiniClusterConfiguration}
 
@@ -119,7 +120,7 @@ trait WithFlinkSQLEngineLocal extends KyuubiFunSuite with 
WithFlinkTestResources
 
     val memory = conf.get(ENGINE_FLINK_MEMORY)
     command += s"-Xmx$memory"
-    val javaOptions = conf.get(ENGINE_FLINK_JAVA_OPTIONS)
+    val javaOptions = 
conf.get(ENGINE_FLINK_JAVA_OPTIONS).filter(StringUtils.isNotBlank(_))
     if (javaOptions.isDefined) {
       command += javaOptions.get
     }
diff --git 
a/kyuubi-common/src/main/scala/org/apache/kyuubi/engine/deploy/yarn/EngineYarnModeSubmitter.scala
 
b/kyuubi-common/src/main/scala/org/apache/kyuubi/engine/deploy/yarn/EngineYarnModeSubmitter.scala
index 552a3158f..6b9c8c9a5 100644
--- 
a/kyuubi-common/src/main/scala/org/apache/kyuubi/engine/deploy/yarn/EngineYarnModeSubmitter.scala
+++ 
b/kyuubi-common/src/main/scala/org/apache/kyuubi/engine/deploy/yarn/EngineYarnModeSubmitter.scala
@@ -27,6 +27,7 @@ import scala.collection.JavaConverters._
 import scala.collection.mutable
 import scala.collection.mutable.ListBuffer
 
+import org.apache.commons.lang3.StringUtils
 import org.apache.hadoop.conf.Configuration
 import org.apache.hadoop.fs.{FileSystem, Path}
 import org.apache.hadoop.fs.permission.FsPermission
@@ -145,7 +146,8 @@ abstract class EngineYarnModeSubmitter extends Logging {
 
     val javaOpts = ListBuffer[String]()
 
-    val javaOptions = kyuubiConf.get(ENGINE_DEPLOY_YARN_MODE_JAVA_OPTIONS)
+    val javaOptions =
+      
kyuubiConf.get(ENGINE_DEPLOY_YARN_MODE_JAVA_OPTIONS).filter(StringUtils.isNotBlank(_))
     if (javaOptions.isDefined) {
       javaOpts += javaOptions.get
     }
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/chat/ChatProcessBuilder.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/chat/ChatProcessBuilder.scala
index 5336e8389..f75b31c22 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/chat/ChatProcessBuilder.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/chat/ChatProcessBuilder.scala
@@ -23,6 +23,7 @@ import java.nio.file.{Files, Paths}
 import scala.collection.mutable
 
 import com.google.common.annotations.VisibleForTesting
+import org.apache.commons.lang3.StringUtils
 
 import org.apache.kyuubi.{Logging, SCALA_COMPILE_VERSION, Utils}
 import org.apache.kyuubi.config.KyuubiConf
@@ -65,7 +66,7 @@ class ChatProcessBuilder(
     val memory = conf.get(ENGINE_CHAT_MEMORY)
     buffer += s"-Xmx$memory"
 
-    val javaOptions = conf.get(ENGINE_CHAT_JAVA_OPTIONS)
+    val javaOptions = 
conf.get(ENGINE_CHAT_JAVA_OPTIONS).filter(StringUtils.isNotBlank(_))
     javaOptions.foreach(buffer += _)
 
     val classpathEntries = new mutable.LinkedHashSet[String]
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/flink/FlinkProcessBuilder.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/flink/FlinkProcessBuilder.scala
index 241b7ec78..cb5a1ac1e 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/flink/FlinkProcessBuilder.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/flink/FlinkProcessBuilder.scala
@@ -23,6 +23,7 @@ import java.nio.file.{Files, Paths}
 import scala.collection.mutable
 
 import com.google.common.annotations.VisibleForTesting
+import org.apache.commons.lang3.StringUtils
 
 import org.apache.kyuubi._
 import org.apache.kyuubi.config.{KyuubiConf, KyuubiReservedKeys}
@@ -154,7 +155,7 @@ class FlinkProcessBuilder(
 
         val memory = conf.get(ENGINE_FLINK_MEMORY)
         buffer += s"-Xmx$memory"
-        val javaOptions = conf.get(ENGINE_FLINK_JAVA_OPTIONS)
+        val javaOptions = 
conf.get(ENGINE_FLINK_JAVA_OPTIONS).filter(StringUtils.isNotBlank(_))
         if (javaOptions.isDefined) {
           buffer += javaOptions.get
         }
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/hive/HiveProcessBuilder.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/hive/HiveProcessBuilder.scala
index 903e06575..5796b494d 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/hive/HiveProcessBuilder.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/hive/HiveProcessBuilder.scala
@@ -23,6 +23,7 @@ import java.nio.file.{Files, Paths}
 import scala.collection.mutable
 
 import com.google.common.annotations.VisibleForTesting
+import org.apache.commons.lang3.StringUtils
 
 import org.apache.kyuubi._
 import org.apache.kyuubi.config.KyuubiConf
@@ -61,7 +62,7 @@ class HiveProcessBuilder(
 
     val memory = conf.get(ENGINE_HIVE_MEMORY)
     buffer += s"-Xmx$memory"
-    val javaOptions = conf.get(ENGINE_HIVE_JAVA_OPTIONS)
+    val javaOptions = 
conf.get(ENGINE_HIVE_JAVA_OPTIONS).filter(StringUtils.isNotBlank(_))
     if (javaOptions.isDefined) {
       buffer += javaOptions.get
     }
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/jdbc/JdbcProcessBuilder.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/jdbc/JdbcProcessBuilder.scala
index de93fd44b..b6649d357 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/jdbc/JdbcProcessBuilder.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/jdbc/JdbcProcessBuilder.scala
@@ -23,6 +23,7 @@ import java.nio.file.Paths
 import scala.collection.mutable
 
 import com.google.common.annotations.VisibleForTesting
+import org.apache.commons.lang3.StringUtils
 
 import org.apache.kyuubi.{Logging, SCALA_COMPILE_VERSION, Utils}
 import org.apache.kyuubi.config.KyuubiConf
@@ -68,7 +69,7 @@ class JdbcProcessBuilder(
     val memory = conf.get(ENGINE_JDBC_MEMORY)
     buffer += s"-Xmx$memory"
 
-    val javaOptions = conf.get(ENGINE_JDBC_JAVA_OPTIONS)
+    val javaOptions = 
conf.get(ENGINE_JDBC_JAVA_OPTIONS).filter(StringUtils.isNotBlank(_))
     javaOptions.foreach(buffer += _)
 
     val classpathEntries = new mutable.LinkedHashSet[String]
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/trino/TrinoProcessBuilder.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/trino/TrinoProcessBuilder.scala
index c07c92fd8..6c21215b5 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/trino/TrinoProcessBuilder.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/trino/TrinoProcessBuilder.scala
@@ -23,6 +23,7 @@ import java.nio.file.Paths
 import scala.collection.mutable
 
 import com.google.common.annotations.VisibleForTesting
+import org.apache.commons.lang3.StringUtils
 
 import org.apache.kyuubi.{Logging, SCALA_COMPILE_VERSION, Utils}
 import org.apache.kyuubi.config.KyuubiConf
@@ -62,7 +63,7 @@ class TrinoProcessBuilder(
 
     val memory = conf.get(ENGINE_TRINO_MEMORY)
     buffer += s"-Xmx$memory"
-    val javaOptions = conf.get(ENGINE_TRINO_JAVA_OPTIONS)
+    val javaOptions = 
conf.get(ENGINE_TRINO_JAVA_OPTIONS).filter(StringUtils.isNotBlank(_))
     if (javaOptions.isDefined) {
       buffer += javaOptions.get
     }

Reply via email to