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

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


The following commit(s) were added to refs/heads/branch-0.12 by this push:
     new b66142e6de [ZEPPELIN-6150] `zeppelin.sh` shall respect HADOOP_HOME to 
find `hadoop` command
b66142e6de is described below

commit b66142e6de56a74a3d01c113eb714006e97c77db
Author: Cheng Pan <cheng...@apache.org>
AuthorDate: Fri Nov 15 19:17:36 2024 +0800

    [ZEPPELIN-6150] `zeppelin.sh` shall respect HADOOP_HOME to find `hadoop` 
command
    
    ### What is this PR for?
    
    Obviously, `*_HOME` should be respected if they are present, otherwise 
fallback to find the command in `PATH`.
    
    ### What type of PR is it?
    
    Improvement
    
    ### What is the Jira issue?
    
    ZEPPELIN-6150
    
    ### How should this be tested?
    
    Manually tested on a dev env, there are multiple Hadoop clients installed 
in one machine, and `hadoop` is not available in `PATH`, now I can set 
`HADOOP_HOME` to allow Zeppelin start.
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the license files need to update? no
    * Is there breaking changes for older versions? might be
    * Does this needs documentation? no
    
    Closes #4899 from pan3793/ZEPPELIN-6150.
    
    Signed-off-by: Cheng Pan <cheng...@apache.org>
    (cherry picked from commit d21e3628618d33c0557fae00989f85c4fce9c1a3)
    Signed-off-by: Cheng Pan <cheng...@apache.org>
---
 bin/zeppelin.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bin/zeppelin.sh b/bin/zeppelin.sh
index efd3aae8b8..9c1f7a9b41 100755
--- a/bin/zeppelin.sh
+++ b/bin/zeppelin.sh
@@ -121,7 +121,9 @@ if [[ "${USE_HADOOP}" != "false"  ]]; then
     echo "Please specify HADOOP_CONF_DIR if USE_HADOOP is true"
   else
     ZEPPELIN_CLASSPATH+=":${HADOOP_CONF_DIR}"
-    if ! [ -x "$(command -v hadoop)" ]; then
+    if [ -n "${HADOOP_HOME}" ]; then
+      ZEPPELIN_CLASSPATH+=":`${HADOOP_HOME}/bin/hadoop classpath`"
+    elif ! [ -x "$(command -v hadoop)" ]; then
       echo 'hadoop command is not in PATH when HADOOP_CONF_DIR is specified.'
     else
       ZEPPELIN_CLASSPATH+=":`hadoop classpath`"

Reply via email to