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

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


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

commit edff97d3e9aa586184eb3b77e23eb104515d03d7
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'
    
    # :mag: Description
    ## Issue References ๐Ÿ”—
    
    This pull request fixes #6549
    
    ## Describe Your Solution ๐Ÿ”ง
    
    When obtaining configuration items, if it is null or empty, return none
    
    ## Types of changes :bookmark:
    
    - [ ] 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)
    
    ## Test Plan ๐Ÿงช
    
    #### Behavior Without This Pull Request :coffin:
    
    #### Behavior With This Pull Request :tada:
    
    #### Related Unit Tests
    
    ---
    
    # Checklist ๐Ÿ“
    
    - [ ] 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]>
---
 .../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 ++-
 .../org/apache/kyuubi/engine/jdbc/JdbcYarnModeProcessBuilder.scala    | 4 +++-
 .../scala/org/apache/kyuubi/engine/trino/TrinoProcessBuilder.scala    | 3 ++-
 8 files changed, 18 insertions(+), 8 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 e0fbe1667..44880fb03 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
@@ -29,6 +29,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
@@ -201,7 +202,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 3fa7ea50a..9597c974f 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
@@ -152,7 +153,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 da035fcf9..8fc14d4ca 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.hadoop.security.UserGroupInformation
 
 import org.apache.kyuubi._
@@ -62,7 +63,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 e31376f36..6d7b66aac 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.hadoop.security.UserGroupInformation
 
 import org.apache.kyuubi.{KyuubiException, Logging, SCALA_COMPILE_VERSION, 
Utils}
@@ -71,7 +72,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/jdbc/JdbcYarnModeProcessBuilder.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/jdbc/JdbcYarnModeProcessBuilder.scala
index fbc4416d7..0fb8d6646 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/jdbc/JdbcYarnModeProcessBuilder.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/jdbc/JdbcYarnModeProcessBuilder.scala
@@ -23,6 +23,8 @@ import java.util
 import scala.collection.JavaConverters._
 import scala.collection.mutable.ArrayBuffer
 
+import org.apache.commons.lang3.StringUtils
+
 import org.apache.kyuubi.{Logging, SCALA_COMPILE_VERSION, Utils}
 import org.apache.kyuubi.config.KyuubiConf
 import org.apache.kyuubi.config.KyuubiConf.{ENGINE_JDBC_EXTRA_CLASSPATH, 
ENGINE_JDBC_MEMORY}
@@ -93,7 +95,7 @@ class JdbcYarnModeProcessBuilder(
   private def jarFiles(isClasspath: Boolean): util.LinkedHashSet[String] = {
     val jarEntries = new util.LinkedHashSet[String]
     mainResource.foreach(jarEntries.add)
-    val javaOptions = conf.get(ENGINE_JDBC_EXTRA_CLASSPATH)
+    val javaOptions = 
conf.get(ENGINE_JDBC_EXTRA_CLASSPATH).filter(StringUtils.isNotBlank(_))
     if (isClasspath) {
       javaOptions.foreach(jarEntries.add)
     }
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