桶的使用

CREATE TABLE B(id BIGINT)

COMMENT 'A bucketed copy of user_info'

CLUSTERED BY(id) INTO 10 BUCKETS;



CREATE TABLE B1(id BIGINT);

LOAD DATA local INPATH '/home/hadoop/1.txt' overwrite into table B1;

set hive.enforce.bucketing = true;  

INSERT OVERWRITE TABLE B SELECT * FROM B1;



dfs -ls /user/hive/warehouse/b;



set hive.enforce.bucketing = true;

Insert overwrite table B

select A.a as id from test1 A left outer join B on A.a= B.id where B.id is null

union all 

select id from B;

 桶表改写,在网上一直没看着.自己弄的union all老数据然后再改写.

你可能感兴趣的:(使用)