hive创建表sql

--分区表-textfile

create table if not exists database_m.M_A3415_CALCULATE_TMP_TMP
(acc_dt varchar(8) COMMENT'会计日期' ,
acc_tm varchar(6) COMMENT'会计期间' ,
inst_no varchar(8) COMMENT'机构代码' ,
idx_code varchar(15) COMMENT'指标代码' ,
idx_name varchar(500) COMMENT'指标名称' ,
source_id varchar(11) COMMENT'数据源代码' ,
xxtj_bal decimal(30,2) COMMENT'余额' ,
xxtj_amt decimal(30,2) COMMENT'发生额' ,
currency_cd varchar(3) COMMENT'币种代码' ,
xxtj_text string COMMENT'文本' ,
filed1 string COMMENT'备用字段1' ,
filed2 string COMMENT'备用字段2' ,
filed3 string COMMENT'备用字段3' ,
filed4 string COMMENT'备用字段4' ,
filed5 string COMMENT'备用字段5' ,
filed6 string COMMENT'备用字段6' ,
filed7 string COMMENT'备用字段7' ,
filed8 string COMMENT'备用字段8' ,
filed9 string COMMENT'备用字段9' ,
filed10 string COMMENT'备用字段10' ,
xxtj_timestamp timestamp COMMENT'信息统计时间戳',
validity_check string COMMENT'是否有效'
)
partitioned by(xxtj_data string)
row format serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' with serdeproperties('field.delim'='\001','serialization.null.format' ='') stored as textfile;

--普通表-textfile

create table if not exists database_m.M_ATP_CRD_G21
(
acc_date VARCHAR(8) ,
curr_type VARCHAR(3) ,
sjydm VARCHAR(9) ,
hqck decimal(30,6),
xxtj_timestamp TIMESTAMP comment '',
validity_check String comment ''
)
row format serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' with serdeproperties('field.delim'='\001','serialization.null.format' ='') stored as textfile;

posted @ 2021-07-09 14:13  rjm123456  阅读(438)  评论(0编辑  收藏  举报