- Hive分区与分桶:
1.创建表进行分区和分桶
create table t_test (id int)
partitioned by (type string)
clustered by (id) into 3 buckets
row format delimited fields terminated by '\t';
【注】“partitioned by”必须在“clustered by”前面
2.插入数据
insert into t_test partition (type='test') values (1);
【注】“partition (type='test')”需要提前