hive建表范例

建表范例:支持update和delete

create table aaa(
id string,
visitor_name string
)
clustered by(id) into 2 buckets
stored as orc TBLPROPERTIES('transactional'='true');

 

目前只有ORCFileformat支持AcidOutputFormat,另外,建表时必须指定('transactional' = true)
2.alter table aaa set serdeproperties('serialization.null.format' = ''); -- 这个是设置null在hdfs里的处理方式

注意: stored as orc 的情况下,不能使用insert overwrite table,不支持。

create table if not exists aaa( id string, user_name string)
row format delimited fields terminated by '\t' stored as textfile;

 

stored as textfile可以支持"insert overwrite table "

 3.建表范例:textfile

create table if not exists user(
id string comment 'openId', 
phone string comment '电话', 
user_name string comment '用户名', 
sex string comment '性别,直接存男女', 
certificate_no string comment '身份证',  
create_time string 
) row format delimited fields terminated by
'\t' NULL DEFINED AS '' stored as textfile;

附上 PARQUET 的压缩算法等设置

PARQUET 的压缩算法等设置

 

posted @ 2018-08-09 11:10  君子笑而不语  阅读(7610)  评论(0编辑  收藏  举报