TING WANG created KYLIN-2863:
--------------------------------
Summary: fix the double caret bug in sample.sh when executed in
old bash version of some enterprise OS
Key: KYLIN-2863
URL: https://issues.apache.org/jira/browse/KYLIN-2863
Project: Kylin
Issue Type: Bug
Components: Tools, Build and Test
Affects Versions: v2.1.0, v2.0.0
Environment: OS: SuSE 11 sp4
Hortonworks hdp 2.6.1.0-129
hadoop 2.7.3
hbase 1.1.2
hive 1.2.1
jdk 1.8.0
Reporter: TING WANG
Assignee: hongbin ma
Fix For: v2.1.0, v2.0.0
Attachments: fixbug-tina-double-caret.patch
When an old version bash is used, the following error will occur:
bq. /apache-kylin-2.0.0-bin/bin # ./sample.sh
bq. Retrieving hadoop conf dir...
bq. Retrieving hadoop conf dir...
bq. KYLIN_HOME is set to /usr/share/kylin/apache-kylin-2.0.0-bin
bq. Loading sample data into HDFS tmp path: /tmp/kylin/sample_cube/data
bq. ./sample.sh: line 40: ${sample_database^^}: bad substitution
bq. Going to create sample tables in hive to database default by cli
bq. ......
If you ignore the error above, another error will occur when building cube:
bq. java.lang.IllegalStateException: No resource found at --
/table/DEFAULT.KYLIN_SALES.json
bq. at
org.apache.kylin.engine.mr.common.AbstractHadoopJob.dumpResources(AbstractHadoopJob.java:550)
bq. at
org.apache.kylin.engine.mr.common.AbstractHadoopJob.dumpKylinPropsAndMetadata(AbstractHadoopJob.java:505)
bq. at
org.apache.kylin.engine.mr.common.AbstractHadoopJob.attachCubeMetadata(AbstractHadoopJob.java:458)
bq. at
org.apache.kylin.engine.mr.steps.FactDistinctColumnsJob.run(FactDistinctColumnsJob.java:122)
bq. at org.apache.kylin.engine.mr.MRUtil.runMRJob(MRUtil.java:102)
bq. at
org.apache.kylin.engine.mr.common.MapReduceExecutable.doWork(MapReduceExecutable.java:123)
bq. at
org.apache.kylin.job.execution.AbstractExecutable.execute(AbstractExecutable.java:124)
bq. at
org.apache.kylin.job.execution.DefaultChainedExecutable.doWork(DefaultChainedExecutable.java:64)
bq. at
org.apache.kylin.job.execution.AbstractExecutable.execute(AbstractExecutable.java:124)
bq. at
org.apache.kylin.job.impl.threadpool.DefaultScheduler$JobRunner.run(DefaultScheduler.java:142)
bq. at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
bq. at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
bq. at java.lang.Thread.run(Thread.java:745)
bq. result code:2
The reason is that the Bash version in SuSE 11 sp4 enterprise is quite old:
bq. #: bash -version
bq. bash -version
bq. GNU bash, version 3.2.57(1)-release (x86_64-suse-linux-gnu)
bq. Copyright (C) 2007 Free Software Foundation, Inc.
Instead of using double carets to convert the string to uppercase, we can use
the tr command to do the same job as shown in this pr which has higher
compatibility for various kinds of OS.
Thanks!
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)