Skip to content

Commit

Permalink
[KYUUBI apache#6126] Filter blank engine home env
Browse files Browse the repository at this point in the history
# 🔍 Description
## Issue References 🔗

This pull request fixes apache#6126

## Describe Your Solution 🔧

Filter blank engine home env

## Types of changes 🔖

- [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 ⚰️

#### Behavior With This Pull Request 🎉

#### 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 apache#6127 from wForget/KYUUBI-6126.

Closes apache#6126

a42a8a6 [wforget] fix typo
55d2bfc [wforget] [KYUUBI-6126] Filter blank engine home env

Authored-by: wforget <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
(cherry picked from commit 9e7f2d0)
  • Loading branch information
wForget committed Mar 14, 2024
1 parent a08447c commit 734fdbd
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import scala.collection.JavaConverters._

import com.google.common.annotations.VisibleForTesting
import com.google.common.collect.EvictingQueue
import org.apache.commons.lang3.StringUtils
import org.apache.commons.lang3.StringUtils.containsIgnoreCase

import org.apache.kyuubi._
Expand Down Expand Up @@ -306,7 +307,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") ->
Expand All @@ -319,7 +320,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 =>
Expand Down

0 comments on commit 734fdbd

Please sign in to comment.