In hive, once the table is created with n buckets. Is their any way to increase number of buckets?
Asked
Active
Viewed 93 times
1 Answers
0
Buckets are physical folders so we cant do it easily. You need to recreate the table with new structure.
step 1 - create a table with new structure.
CREATE TABLE [db_name.]newtable (...)
[CLUSTERED BY (col_name, col_name, ...) INTO num_buckets BUCKETS;
step 2 - reload newtable from original.
insert into newtable select * from mytable;
step 3 - drop original table and rename new table to original.
drop table mytable;
alter table newtable rename to mytable;

Koushik Roy
- 6,868
- 2
- 12
- 33