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 的壓縮算法等設置

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM