KYLIN-2505, remove hardcode to avoid possible syntax errors

Signed-off-by: Hongbin Ma <[email protected]>


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

Branch: refs/heads/master-hbase0.98
Commit: 3ce48199164424734696497ddd3eef90efff9563
Parents: b53f2b6
Author: Cheng Wang <[email protected]>
Authored: Mon Mar 13 15:39:07 2017 +0800
Committer: Hongbin Ma <[email protected]>
Committed: Tue Mar 14 14:21:27 2017 +0800

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


http://git-wip-us.apache.org/repos/asf/kylin/blob/3ce48199/build/bin/sample.sh
----------------------------------------------------------------------
diff --git a/build/bin/sample.sh b/build/bin/sample.sh
index 4c65bcf..f4d63d8 100644
--- a/build/bin/sample.sh
+++ b/build/bin/sample.sh
@@ -44,8 +44,9 @@ 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
-#### Caution: hard code the beeline parameter by appending sample database.
-    beeline ${beeline_params}"/"$sample_database -f 
${KYLIN_HOME}/sample_cube/create_sample_tables.sql  || { exit 1; }
+    hive2_url=`expr match "${beeline_params}" '.*\(hive2:.*:[0-9]\{4,6\}\)'`
+    
beeline_params=${beeline_params//${hive2_url}/${hive2_url}/${sample_database}}
+    beeline ${beeline_params} -f 
${KYLIN_HOME}/sample_cube/create_sample_tables.sql  || { exit 1; }
 else
     hive -e "CREATE DATABASE IF NOT EXISTS "$sample_database
     hive --database $sample_database -f 
${KYLIN_HOME}/sample_cube/create_sample_tables.sql  || { exit 1; }

Reply via email to