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 ed8fb9698 [KYUUBI #6126] Filter blank engine home env
ed8fb9698 is described below

commit ed8fb96984829a476ed00c302c22db6fc2611bc9
Author: wforget <[email protected]>
AuthorDate: Wed Mar 6 12:06:46 2024 +0800

    [KYUUBI #6126] Filter blank engine home env
    
    # :mag: Description
    ## Issue References ๐Ÿ”—
    
    This pull request fixes #6126
    
    ## Describe Your Solution ๐Ÿ”ง
    
    Filter blank engine home env
    
    ## Types of changes :bookmark:
    
    - [X] 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 ๐Ÿ“
    
    - [X] This patch was not authored or co-authored using [Generative 
Tooling](https://www.apache.org/legal/generative-tooling.html)
    
    **Be nice. Be informative.**
    
    Closes #6127 from wForget/KYUUBI-6126.
    
    Closes #6126
    
    a42a8a611 [wforget] fix typo
    55d2bfc34 [wforget] [KYUUBI-6126] Filter blank engine home env
    
    Authored-by: wforget <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit 9e7f2d040262bdb58a016badf3c946deab3db7a1)
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala        | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
index 64276493a..ff55afa59 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/ProcBuilder.scala
@@ -25,6 +25,7 @@ import java.nio.file.{Files, Path, Paths}
 import scala.collection.JavaConverters._
 
 import com.google.common.collect.EvictingQueue
+import org.apache.commons.lang3.StringUtils
 import org.apache.commons.lang3.StringUtils.containsIgnoreCase
 
 import org.apache.kyuubi._
@@ -304,7 +305,7 @@ trait ProcBuilder {
    *
    * Take Spark as an example, we first lookup the SPARK_HOME from user 
specified environments.
    * If not found, we assume that it is a dev environment and lookup the 
kyuubi-download's output
-   * directly. If not found again, a `KyuubiSQLException` will be raised.
+   * directory. If not found again, a `KyuubiSQLException` will be raised.
    * In summarize, we walk through
    *   `kyuubi.engineEnv.SPARK_HOME` ->
    *   System.env("SPARK_HOME") ->
@@ -317,7 +318,7 @@ trait ProcBuilder {
   protected def getEngineHome(shortName: String): String = {
     val homeKey = s"${shortName.toUpperCase}_HOME"
     // 1. get from env, e.g. SPARK_HOME, FLINK_HOME
-    env.get(homeKey)
+    env.get(homeKey).filter(StringUtils.isNotBlank)
       .orElse {
         // 2. get from $KYUUBI_HOME/externals/kyuubi-download/target
         env.get(KYUUBI_HOME).flatMap { p =>

Reply via email to