hive建表语句

----导入hdfs建表

use ods_db;
CREATE EXTERNAL TABLE BER_O2O_PV
(
JSON STRING
)PARTITIONEDBY(YEARSTRING,MONTHSTRING)
STORED AS TEXTFILE
LOCATION '/ODS/ODS_DB/BER_O2O_PV';

 

CREATE EXTERNAL TABLE BER_O2O_USER_LABLE
(
LABLE_ID STRING,
LABLE_NAME STRING,
LABLE_TYPE STRING,
RID STRING,
LEVEL_ID STRING
)ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE
LOCATION '/ODS/ODS_DB/BER_O2O_USER_LABLE';

 

 

----------hive分析建表

 


USE PARSEDB;
---TMP----
CREATE TABLE FACT_BI_BROWSER_T_00
(
CHANNEL STRING,
SESSION_ID STRING,
APP_ID STRING,
IP STRING,
REF_URL STRING,
URL STRING,
STAY_TIME STRING,
LOG_TIME STRING,
BROWSER STRING
) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
STORED AS TEXTFILE;


CREATE TABLE FACT_BI_BROWSER_T_01
(
BR_NAME STRING,
BI_VALUE DOUBLE,
BI_DATETIME STRING,
BI_CHANNEL STRING
)ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
STORED AS TEXTFILE;

----FACT-----
CREATE EXTERNAL TABLE FACT_BI_BROWSER_T
(
ID STRING,
BI_TYPE STRING,
BR_NAME STRING,
BI_VALUE DOUBLE,
BI_DATETIME STRING,
BI_CHANNEL STRING
)PARTITIONED BY (YEAR STRING, MONTH STRING, DAY STRING )
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
STORED AS TEXTFILE
LOCATION '/RESULT/PARSEDB/FACT_BI_BROWSER_T';

 

posted @ 2018-12-14 17:37  何国秀_xue  阅读(3812)  评论(0编辑  收藏  举报