Hive表

2019-04-03  本文已影响0人  焱三土

Hive分区

 CREATE TABLE logs(ts bigint,
                   line string) 
 PARTITIONED BY(dt string,country string)
LOAD DATA LOCAL INPATH 'input/hive/partitions/file1'
INTO TABLE logs
PARTITION (dt='2001-01-01',country='GB')
hive > SHOW PARTITIONS logs;

Hive分桶

CREATE TABLE user (
                    id INT ,
                    name STRING,
                    age INT
                             ) 
CLUSTERED BY (id) INTO 4 BUCKETS ;
CREATE TABLE user (
                    id INT ,
                    name STRING,
                    age INT
                             ) 
CLUSTERED BY(id) SORTED BY (id ASC)  INTO 4 BUCKETS;
INSERT OVERWRITE TABLE user
SELECT * FROM data

后续的还会遇到坑还会继续添加

上一篇下一篇

猜你喜欢

热点阅读