码迷,mamicode.com
首页 > 其他好文 > 详细

hive建表语句

时间:2018-12-14 19:26:51      阅读:533      评论:0      收藏:0      [点我收藏+]

标签:one   建表   sed   text   mina   textfile   ref   partition   name   

----导入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‘;

 

hive建表语句

标签:one   建表   sed   text   mina   textfile   ref   partition   name   

原文地址:https://www.cnblogs.com/heguoxiu/p/10120679.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!