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

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


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

commit 8acf1ce5ecef4542233e80cfa44747f6581e23d1
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]>
---
 .../scala/org/apache/kyuubi/engine/flink/WithFlinkSQLEngineLocal.scala | 3 ++-
 .../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 ++-
 6 files changed, 12 insertions(+), 6 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 1c4adce18..251e48e41 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}
 
@@ -118,7 +119,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-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 ddf88e149..fe0f326a5 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
@@ -64,7 +65,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 a1e8cdcd3..974dcd791 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}
@@ -146,7 +147,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 d8e4454b6..a9e24099f 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
@@ -58,7 +59,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 2d08d5101..d7361bd3a 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
@@ -67,7 +68,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 96502fb96..f47828ecc 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
@@ -61,7 +62,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