minor, fix beeline-params bug in sample.sh

Signed-off-by: Billy Liu <billy...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/7d6329b0
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/7d6329b0
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/7d6329b0

Branch: refs/heads/master-hbase0.98
Commit: 7d6329b0dda3bccf04437f803326edc72d27c2db
Parents: 75d50ae
Author: Cheng Wang <cheng.w...@kyligence.io>
Authored: Fri Apr 14 11:08:37 2017 +0800
Committer: Billy Liu <billy...@apache.org>
Committed: Fri Apr 14 11:37:47 2017 +0800

----------------------------------------------------------------------
 build/bin/sample.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/7d6329b0/build/bin/sample.sh
----------------------------------------------------------------------
diff --git a/build/bin/sample.sh b/build/bin/sample.sh
index f4d63d8..617b671 100644
--- a/build/bin/sample.sh
+++ b/build/bin/sample.sh
@@ -44,8 +44,13 @@ if [ "${hive_client_mode}" == "beeline" ]
 then
     beeline_params=`bash ${KYLIN_HOME}/bin/get-properties.sh 
kylin.source.hive.beeline-params`
     beeline ${beeline_params} -e "CREATE DATABASE IF NOT EXISTS 
"$sample_database
-    hive2_url=`expr match "${beeline_params}" '.*\(hive2:.*:[0-9]\{4,6\}\)'`
-    
beeline_params=${beeline_params//${hive2_url}/${hive2_url}/${sample_database}}
+    hive2_url=`expr match "${beeline_params}" '.*\(hive2:.*:[0-9]\{4,6\}\/\)'`
+    if [ -z ${hive2_url} ]; then
+        hive2_url=`expr match "${beeline_params}" 
'.*\(hive2:.*:[0-9]\{4,6\}\)'`
+        
beeline_params=${beeline_params/${hive2_url}/${hive2_url}/${sample_database}}
+    else
+        
beeline_params=${beeline_params/${hive2_url}/${hive2_url}${sample_database}}
+    fi
     beeline ${beeline_params} -f 
${KYLIN_HOME}/sample_cube/create_sample_tables.sql  || { exit 1; }
 else
     hive -e "CREATE DATABASE IF NOT EXISTS "$sample_database

Reply via email to