You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2018/11/26 10:47:27 UTC

[kylin] branch master updated: #KYLIN-3684, HIVE_LIB is not set or not resolved correctly

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 733d574  #KYLIN-3684, HIVE_LIB is not set or not resolved correctly
733d574 is described below

commit 733d5742bb58acc6cf70ccb1909acccbc5668ce4
Author: ZhengshuaiPENG <co...@hotmail.com>
AuthorDate: Wed Nov 14 16:04:40 2018 +0800

    #KYLIN-3684, HIVE_LIB is not set or not resolved correctly
---
 build/bin/find-hive-dependency.sh | 53 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 47 insertions(+), 6 deletions(-)

diff --git a/build/bin/find-hive-dependency.sh b/build/bin/find-hive-dependency.sh
index a8793eb..558c9b5 100755
--- a/build/bin/find-hive-dependency.sh
+++ b/build/bin/find-hive-dependency.sh
@@ -37,6 +37,17 @@ else
     hive_env=`hive ${hive_conf_properties} -e set 2>&1 | grep 'env:CLASSPATH'`
 fi
 
+if [ -z $hive_env ]
+then
+    hive_permission=`hive ${hive_conf_properties} -e set 2>&1 | grep 'No valid credentials provided'`
+    if [ -n "$hive_permission" ]
+    then
+        quit "No valid credentials provided for Hive CLI, please check permission of hive. (e.g. check if Kerberos is expired or not)"
+    else
+        quit "Something wrong with Hive CLI or Beeline, please execute Hive CLI or Beeline CLI in terminal to find the root cause."
+    fi
+fi
+
 hive_classpath=`echo $hive_env | grep 'env:CLASSPATH' | awk -F '=' '{print $2}'`
 arr=(`echo $hive_classpath | cut -d ":" -f 1- | sed 's/:/ /g'`)
 hive_conf_path=
@@ -73,6 +84,11 @@ then
     quit "Couldn't find hive configuration directory. Please set HIVE_CONF to the path which contains hive-site.xml."
 fi
 
+if [ -z "$hive_exec_path" ]
+then
+    quit "Couldn't find hive executable jar. Please check if hive executable jar exists in HIVE_LIB folder."
+fi
+
 # in some versions of hive hcatalog is not in hive's classpath, find it separately
 if [ -z "$HCAT_HOME" ]
 then
@@ -89,7 +105,7 @@ then
     elif [ -n is_aws ] && [ -d "/usr/lib/hive-hcatalog" ]; then
       # special handling for Amazon EMR
       hcatalog_home=/usr/lib/hive-hcatalog
-    else 
+    else
       quit "Couldn't locate hcatalog installation, please make sure it is installed and set HCAT_HOME to the path."
     fi
 else
@@ -106,7 +122,27 @@ fi
 
 function checkFileExist()
 {
-    files=(`echo $1 | cut -d ":" -f 1- | sed 's/:/ /g'`)
+    msg_hint=""
+    if [ "$1" == "hive_lib" ]
+    then
+        msg_hint=", please check jar files in current HIVE_LIB or export HIVE_LIB='YOUR_LOCAL_HIVE_LIB'"
+    elif [ "$1" == "hcatalog" ]
+    then
+        msg_hint=", please check jar files in current HCAT_HOME or export HCAT_HOME='YOUR_LOCAL_HCAT_HOME'"
+    fi
+
+    if [ -z "$2" ]
+    then
+        if [ "$1" == "hive_lib" ]
+        then
+            quit "Current HIVE_LIB is not valid, please export HIVE_LIB='YOUR_LOCAL_HIVE_LIB'"
+        elif [ "$1" == "hcatalog" ]
+        then
+            quit "Current HCAT_HOME is not valid, please export HCAT_HOME='YOUR_LOCAL_HCAT_HOME'"
+        fi
+    fi
+
+    files=(`echo $2 | cut -d ":" -f 1- | sed 's/:/ /g'`)
     misFiles=0
     outputMissFiles=
     for file in ${files}
@@ -119,7 +155,7 @@ function checkFileExist()
     done
     if [ 0 != ${misFiles} ]; then
         times=`expr ${allFiles} / ${misFiles}`
-        [[ ${times} -gt 10 ]] || quit "A couple of hive jars can't be found: ${outputMisFiles}, please export HIVE_LIB='YOUR_LOCAL_HIVE_LIB'"
+        [[ ${times} -gt 10 ]] || quit "A couple of hive jars can't be found: ${outputMisFiles}${msg_hint}"
     fi
 }
 
@@ -146,15 +182,20 @@ function validateDirectory()
 if [ -z "$HIVE_LIB" ]
 then
     verbose "HIVE_LIB is not set, try to retrieve hive lib from hive_exec_path"
-    hive_lib_dir="$(dirname $hive_exec_path)"
+    if [[ $hive_exec_path =~ ^\/.*hive.*\/lib\/hive-exec[a-z0-9A-Z\.-]*.jar ]]
+    then
+        hive_lib_dir="$(dirname $hive_exec_path)"
+    else
+        quit "HIVE_LIB not found, please check hive installation or export HIVE_LIB='YOUR_LOCAL_HIVE_LIB'."
+    fi
 else
     hive_lib_dir="$HIVE_LIB"
 fi
 hive_lib=`find -L ${hive_lib_dir} -name '*.jar' ! -name '*druid*' ! -name '*slf4j*' ! -name '*avatica*' ! -name '*calcite*' ! -name '*jackson-datatype-joda*' ! -name '*derby*' -printf '%p:' | sed 's/:$//'`
 
 validateDirectory ${hive_conf_path}
-checkFileExist ${hive_lib}
-checkFileExist ${hcatalog}
+checkFileExist hive_lib ${hive_lib}
+checkFileExist hcatalog ${hcatalog}
 
 hive_dependency=${hive_conf_path}:${hive_lib}:${hcatalog}
 verbose "hive dependency is $hive_dependency"