You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/03/14 01:02:29 UTC

[44/50] [abbrv] incubator-kylin git commit: KYLIN-634 Script to import sample data and cube metadata

KYLIN-634 Script to import sample data and cube metadata

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

Branch: refs/heads/staging
Commit: 3f1133cf3d3328c943efccda768aff778cd4b41b
Parents: 54dc31f
Author: Shao Feng, Shi <sh...@ebay.com>
Authored: Thu Mar 12 17:40:29 2015 +0800
Committer: Shao Feng, Shi <sh...@ebay.com>
Committed: Thu Mar 12 17:40:29 2015 +0800

----------------------------------------------------------------------
 bin/check-env.sh                                |     7 +-
 bin/kylin.sh                                    |     2 +-
 bin/sample.sh                                   |     6 +
 examples/sample_cube/create_sample_tables.sql   |   172 +
 .../sample_cube/data/DEFAULT.KYLIN_CAL_DT.csv   |   731 ++
 .../data/DEFAULT.KYLIN_CATEGORY_GROUPINGS.csv   |   144 +
 .../sample_cube/data/DEFAULT.KYLIN_SALES.csv    | 10000 +++++++++++++++++
 .../metadata/cube/kylin_sales_cube.json         |    10 +
 .../cube_desc/kylin_sales_cube_desc.json        |   178 +
 .../metadata/model_desc/kylin_sales_model.json  |    28 +
 .../metadata/project/learn_kylin.json           |    11 +
 .../metadata/table/DEFAULT.KYLIN_CAL_DT.json    |   407 +
 .../table/DEFAULT.KYLIN_CATEGORY_GROUPINGS.json |   151 +
 .../metadata/table/DEFAULT.KYLIN_SALES.json     |    43 +
 script/compress.sh                              |     2 +-
 script/prepare.sh                               |     2 +
 16 files changed, 11889 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/3f1133cf/bin/check-env.sh
----------------------------------------------------------------------
diff --git a/bin/check-env.sh b/bin/check-env.sh
index 14eea70..5380679 100644
--- a/bin/check-env.sh
+++ b/bin/check-env.sh
@@ -3,10 +3,11 @@
 
 if [ -z "$KYLIN_HOME" ]
 then
-	bin=$(dirname ${0})
-	export KYLIN_HOME=$(dirname $bin)
+    echo 'please make sure KYLIN_HOME has been set'
+    exit 1
+else
+    echo "KYLIN_HOME is set to ${KYLIN_HOME}"
 fi
-echo "KYLIN_HOME is set to ${KYLIN_HOME}"
 
 if [ -z "$(command -v hbase version)" ]
 then

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/3f1133cf/bin/kylin.sh
----------------------------------------------------------------------
diff --git a/bin/kylin.sh b/bin/kylin.sh
index 7981bb8..a6983df 100644
--- a/bin/kylin.sh
+++ b/bin/kylin.sh
@@ -47,7 +47,7 @@ then
     -Dkylin.hive.dependency=${hive_dependency} \
     -Dspring.profiles.active=${spring_profile} \
     org.apache.hadoop.util.RunJar ${tomcat_root}/bin/bootstrap.jar  org.apache.catalina.startup.Bootstrap start > ${tomcat_root}/logs/kylin.log 2>&1 & echo $! > ${KYLIN_HOME}/pid &
-    echo "A new Kylin instance is started by $USER, stop it using \"stop-kylin.sh\""
+    echo "A new Kylin instance is started by $USER, stop it using \"kylin.sh stop\""
     if [ "$useSandbox" = "true" ]
         then echo "Please visit http://<your_sandbox_ip>:7070/kylin to play with the cubes! (Useranme: ADMIN, Password: KYLIN)"
     else

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/3f1133cf/bin/sample.sh
----------------------------------------------------------------------
diff --git a/bin/sample.sh b/bin/sample.sh
new file mode 100644
index 0000000..ca324e5
--- /dev/null
+++ b/bin/sample.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+dir=$(dirname ${0})
+job_jar=`ls -ls ${KYLIN_HOME}/lib | grep kylin-job | awk '{print $9}'`
+cd ${KYLIN_HOME}/sample_cube/data
+hive -f ${KYLIN_HOME}/sample_cube/create_sample_tables.sql  || { exit 1; }
+hbase org.apache.hadoop.util.RunJar ${KYLIN_HOME}/lib/${job_jar} org.apache.kylin.common.persistence.ResourceTool upload ${KYLIN_HOME}/sample_cube/metadata  || { exit 1; }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/3f1133cf/examples/sample_cube/create_sample_tables.sql
----------------------------------------------------------------------
diff --git a/examples/sample_cube/create_sample_tables.sql b/examples/sample_cube/create_sample_tables.sql
new file mode 100644
index 0000000..b49b16f
--- /dev/null
+++ b/examples/sample_cube/create_sample_tables.sql
@@ -0,0 +1,172 @@
+DROP TABLE IF EXISTS DEFAULT.KYLIN_CAL_DT;
+
+CREATE TABLE DEFAULT.KYLIN_CAL_DT
+(
+CAL_DT date
+,YEAR_BEG_DT date
+,QTR_BEG_DT date
+,MONTH_BEG_DT date
+,WEEK_BEG_DT date
+,AGE_FOR_YEAR_ID smallint
+,AGE_FOR_QTR_ID smallint
+,AGE_FOR_MONTH_ID smallint
+,AGE_FOR_WEEK_ID smallint
+,AGE_FOR_DT_ID smallint
+,AGE_FOR_RTL_YEAR_ID smallint
+,AGE_FOR_RTL_QTR_ID smallint
+,AGE_FOR_RTL_MONTH_ID smallint
+,AGE_FOR_RTL_WEEK_ID smallint
+,AGE_FOR_CS_WEEK_ID smallint
+,DAY_OF_CAL_ID int
+,DAY_OF_YEAR_ID smallint
+,DAY_OF_QTR_ID smallint
+,DAY_OF_MONTH_ID smallint
+,DAY_OF_WEEK_ID int
+,WEEK_OF_YEAR_ID tinyint
+,WEEK_OF_CAL_ID int
+,MONTH_OF_QTR_ID tinyint
+,MONTH_OF_YEAR_ID tinyint
+,MONTH_OF_CAL_ID smallint
+,QTR_OF_YEAR_ID tinyint
+,QTR_OF_CAL_ID smallint
+,YEAR_OF_CAL_ID smallint
+,YEAR_END_DT string
+,QTR_END_DT string
+,MONTH_END_DT string
+,WEEK_END_DT string
+,CAL_DT_NAME string
+,CAL_DT_DESC string
+,CAL_DT_SHORT_NAME string
+,YTD_YN_ID tinyint
+,QTD_YN_ID tinyint
+,MTD_YN_ID tinyint
+,WTD_YN_ID tinyint
+,SEASON_BEG_DT string
+,DAY_IN_YEAR_COUNT smallint
+,DAY_IN_QTR_COUNT tinyint
+,DAY_IN_MONTH_COUNT tinyint
+,DAY_IN_WEEK_COUNT tinyint
+,RTL_YEAR_BEG_DT string
+,RTL_QTR_BEG_DT string
+,RTL_MONTH_BEG_DT string
+,RTL_WEEK_BEG_DT string
+,CS_WEEK_BEG_DT string
+,CAL_DATE string
+,DAY_OF_WEEK string
+,MONTH_ID string
+,PRD_DESC string
+,PRD_FLAG string
+,PRD_ID string
+,PRD_IND string
+,QTR_DESC string
+,QTR_ID string
+,QTR_IND string
+,RETAIL_WEEK string
+,RETAIL_YEAR string
+,RETAIL_START_DATE string
+,RETAIL_WK_END_DATE string
+,WEEK_IND string
+,WEEK_NUM_DESC string
+,WEEK_BEG_DATE string
+,WEEK_END_DATE string
+,WEEK_IN_YEAR_ID string
+,WEEK_ID string
+,WEEK_BEG_END_DESC_MDY string
+,WEEK_BEG_END_DESC_MD string
+,YEAR_ID string
+,YEAR_IND string
+,CAL_DT_MNS_1YEAR_DT string
+,CAL_DT_MNS_2YEAR_DT string
+,CAL_DT_MNS_1QTR_DT string
+,CAL_DT_MNS_2QTR_DT string
+,CAL_DT_MNS_1MONTH_DT string
+,CAL_DT_MNS_2MONTH_DT string
+,CAL_DT_MNS_1WEEK_DT string
+,CAL_DT_MNS_2WEEK_DT string
+,CURR_CAL_DT_MNS_1YEAR_YN_ID tinyint
+,CURR_CAL_DT_MNS_2YEAR_YN_ID tinyint
+,CURR_CAL_DT_MNS_1QTR_YN_ID tinyint
+,CURR_CAL_DT_MNS_2QTR_YN_ID tinyint
+,CURR_CAL_DT_MNS_1MONTH_YN_ID tinyint
+,CURR_CAL_DT_MNS_2MONTH_YN_ID tinyint
+,CURR_CAL_DT_MNS_1WEEK_YN_IND tinyint
+,CURR_CAL_DT_MNS_2WEEK_YN_IND tinyint
+,RTL_MONTH_OF_RTL_YEAR_ID string
+,RTL_QTR_OF_RTL_YEAR_ID tinyint
+,RTL_WEEK_OF_RTL_YEAR_ID tinyint
+,SEASON_OF_YEAR_ID tinyint
+,YTM_YN_ID tinyint
+,YTQ_YN_ID tinyint
+,YTW_YN_ID tinyint
+,CRE_DATE string
+,CRE_USER string
+,UPD_DATE string
+,UPD_USER string
+)
+ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
+STORED AS TEXTFILE;
+
+DROP TABLE IF EXISTS DEFAULT.KYLIN_CATEGORY_GROUPINGS;
+
+CREATE TABLE DEFAULT.KYLIN_CATEGORY_GROUPINGS
+(
+LEAF_CATEG_ID bigint
+,LEAF_CATEG_NAME string
+,SITE_ID int
+,CATEG_BUSN_MGR string
+,CATEG_BUSN_UNIT string
+,REGN_CATEG string
+,USER_DEFINED_FIELD1 string
+,USER_DEFINED_FIELD3 string
+,CRE_DATE string
+,UPD_DATE string
+,CRE_USER string
+,UPD_USER string
+,META_CATEG_ID decimal
+,META_CATEG_NAME string
+,CATEG_LVL2_ID decimal
+,CATEG_LVL3_ID decimal
+,CATEG_LVL4_ID decimal
+,CATEG_LVL5_ID decimal
+,CATEG_LVL6_ID decimal
+,CATEG_LVL7_ID decimal
+,CATEG_LVL2_NAME string
+,CATEG_LVL3_NAME string
+,CATEG_LVL4_NAME string
+,CATEG_LVL5_NAME string
+,CATEG_LVL6_NAME string
+,CATEG_LVL7_NAME string
+,CATEG_FLAGS decimal
+,ADULT_CATEG_YN string
+,DOMAIN_ID decimal
+,USER_DEFINED_FIELD5 string
+,VCS_ID decimal
+,GCS_ID decimal
+,MOVE_TO decimal
+,SAP_CATEGORY_ID decimal
+,SRC_ID tinyint
+,BSNS_VRTCL_NAME string
+)
+ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
+STORED AS TEXTFILE;
+
+DROP TABLE IF EXISTS DEFAULT.KYLIN_SALES;
+
+CREATE TABLE DEFAULT.KYLIN_SALES
+(
+TRANS_ID bigint
+,CAL_DT date
+,LSTG_FORMAT_NAME string
+,LEAF_CATEG_ID bigint
+,LSTG_SITE_ID int
+,SLR_SEGMENT_CD smallint
+,PRICE decimal(19,4)
+,ITEM_COUNT bigint
+,SELLER_ID bigint
+)
+ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
+STORED AS TEXTFILE;
+
+LOAD DATA LOCAL INPATH 'DEFAULT.KYLIN_SALES.csv' OVERWRITE INTO TABLE DEFAULT.KYLIN_SALES;
+LOAD DATA LOCAL INPATH 'DEFAULT.KYLIN_CAL_DT.csv' OVERWRITE INTO TABLE DEFAULT.KYLIN_CAL_DT;
+LOAD DATA LOCAL INPATH 'DEFAULT.KYLIN_CATEGORY_GROUPINGS.csv' OVERWRITE INTO TABLE DEFAULT.KYLIN_CATEGORY_GROUPINGS;
\ No newline at end of file